[BUG] Error running migrate command
speedlight opened this issue · comments
Environment
Please provide as many details as you can:
- Hosting type
- Form.io
- On-premise environment
- Local deployment
- Version:
- Formio.js version: 7.0.0-rc46
Steps to Reproduce
- Run
./bin/formio migrate https://portal.form.io/\#/project/xxxxxxxxx/form/aaaaaaa form https://forms.example.com/\#/project/xxxxxxxxx/form/aaaaaa/ --src-username USERNAME --src-password PASSWORD --username USERNAME --password PASSWORD
Expected behavior
The migrate command finish sucessufly
Observed behavior
The following error:
This action requires a login to SOURCE::https://form.io#/project/xxxxxxxx/form/aaaaaaaaa.
Authenticating to https://form.io#/project/5d95720e46ae113bad5db10b/form/5fa408bd2149cc648af23eb2
Authentication successful
This action requires a login to DESTINATION::https://forms.example.com#/project/xxxxxx/form/aaaaaaa/.
Authenticating to https://forms.example.com#/project/xxxxxx/form/aaaaaaa/
Authentication successful
Migrating to https://forms.example.com/#/project/xxxxxxxx/form/aaaaaaa/internal/streams/legacy.js:61
throw er; // Unhandled stream error in pipe.
^
Error: Invalid JSON (Unexpected "!" at position 1 in state STOP)
at Parser.proto.charError (/home/user/formio-cli/node_modules/jsonparse/jsonparse.js:90:16)
at Parser.proto.write (/home/user/formio-cli/node_modules/jsonparse/jsonparse.js:267:27)
at Stream.<anonymous> (/home/user/formio-cli/node_modules/JSONStream/index.js:23:12)
at Stream.stream.write (/home/user/formio-cli/node_modules/through/index.js:26:11)
at Request.ondata (internal/streams/legacy.js:19:31)
at Request.emit (events.js:314:20)
at IncomingMessage.<anonymous> (/home/user/formio-cli/node_modules/request/request.js:1073:12)
at IncomingMessage.emit (events.js:314:20)
at IncomingMessage.Readable.read (_stream_readable.js:508:10)
at flow (_stream_readable.js:1008:34)
Try using the API urls instead of the application urls, as I described in #27
Using the API urls and with --src-key
and dst-key
arguments is giving the same error
This action requires a login to SOURCE::https://form.io.
An API Key was provided. Authenticated as Project Owner.
This action requires a login to DESTINATION::https://forms.example.com.
An API Key was provided. Authenticated as Project Owner.
Migrating to https://forms.example.com/staging-xljyeecpixhyjmz/formAPI/pathinternal/streams/legacy.js:61
throw er; // Unhandled stream error in pipe.
^
Error: Invalid JSON (Unexpected "U" at position 0 in state STOP)
at Parser.proto.charError (/home/user/formio-cli/node_modules/jsonparse/jsonparse.js:90:16)
at Parser.proto.write (/home/user/formio-cli/node_modules/jsonparse/jsonparse.js:154:23)
at Stream.<anonymous> (/home/user/formio-cli/node_modules/JSONStream/index.js:23:12)
at Stream.stream.write (/home/user/formio-cli/node_modules/through/index.js:26:11)
at Request.ondata (internal/streams/legacy.js:19:31)
at Request.emit (events.js:314:20)
at IncomingMessage.<anonymous> (/home/user/formio-cli/node_modules/request/request.js:1073:12)
at IncomingMessage.emit (events.js:314:20)
at IncomingMessage.Readable.read (_stream_readable.js:508:10)
at flow (_stream_readable.js:1008:34)
Caught my attention the line before the throw er;
line that is adding internal/streams/legacy.js
just in front of the API path of the form.
The "U" that it is complaining about is that the server is responding with "Unauthorized" which makes me believe that your API keys are not correct in one of the environments.
The API key was ok but I tried deleting the stage and creating a new one, with the new API key the command finished without any output and the form submissions aren't imported.
@DIVYA-19
I expect everything should be behaving as expected in @formio/cli@2.3.0. Let me know if you are still having issues with this latest version and I'll re-open.