cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Error running migrate command

Open speedlight opened this issue 5 years ago • 5 comments

Environment

Please provide as many details as you can:

  • Hosting type
    • [x] Form.io
    • [x] On-premise environment
    • [ ] Local deployment
      • Version:
  • Formio.js version: 7.0.0-rc46

Steps to Reproduce

  1. 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)

speedlight avatar Nov 12 '20 15:11 speedlight

Try using the API urls instead of the application urls, as I described in https://github.com/formio/formio-cli/issues/27

travist avatar Nov 13 '20 14:11 travist

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.

speedlight avatar Nov 16 '20 15:11 speedlight

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.

travist avatar Nov 16 '20 22:11 travist

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.

speedlight avatar Nov 18 '20 20:11 speedlight

I faced the same issue. API keys are correct. But got unauthorized error. @travist

DIVYA-19 avatar Jul 12 '23 04:07 DIVYA-19

@DIVYA-19 I expect everything should be behaving as expected in @formio/[email protected]. Let me know if you are still having issues with this latest version and I'll re-open.

lane-formio avatar Jun 10 '24 14:06 lane-formio