strapi / strapi

🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable, and developer-first.
https://strapi.io
Other
63.27k stars 8k forks source link

Data Transfer errors `throw er; // Unhandled 'error' event` #17483

Open jwright04 opened 1 year ago

jwright04 commented 1 year ago

Bug report

Required System information

Describe the bug

I'm receiving an error when trying to transfer using the CLI. After generating my transfer token, I run the command yarn strapi transfer --to https://my-prod-strapi-app MY-TOKEN --force

I then receiving the following error

Starting transfer...
✔ entities: 21 transfered (size: 10 KB) (elapsed: 357 ms)
⠹ assets: 0 transfered (size: 0) (elapsed: 0 ms) node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: Request failed with status code 404
    at ClientRequest.<anonymous> (/...my-strapi-app/api/node_modules/@strapi/data-transfer/dist/strapi/providers/local-source/assets.js:37:24)
    at Object.onceWrapper (node:events:642:26)
    at ClientRequest.emit (node:events:527:28)
    at ClientRequest.emit (node:domain:475:12)
    at HTTPParser.parserOnIncomingClient (node:_http_client:631:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at TLSSocket.socketOnData (node:_http_client:494:22)
    at TLSSocket.emit (node:events:527:28)
    at TLSSocket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:315:12)
Emitted 'error' event on Duplexify instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.

Steps to reproduce the behavior

  1. Go to Strapi admin
  2. Click on Settings
  3. Click on Transfer tokens
  4. Click on generate token (give yourself full access)
  5. Go to local application terminal
  6. Type the command yarn strapi transfer --to https://my-prod-strapi-app MY-TOKEN --force

Expected behavior

I should not receive the error and my local data should transfer successfully to my remote application

jwright04 commented 1 year ago

After digging into this for a few hours, I downgraded to 4.11.5 and was able to complete my transfer successfully. Definitely seems like an issue with version 4.12

derrickmehaffy commented 1 year ago

It looks like you didn't pass the --to-token, can you confirm in your example the MYTOKEN you just cut that flag out or you weren't passing it?

innerdvations commented 1 year ago

Thanks for the report! Could you please let me know the following for both the local Strapi and the remote Strapi:

guillermo-t3 commented 1 year ago

Same problem in 4.12.5 Token is provided, from s3 to s3. Default admin URL. From local to ec2 / rds (behind docker)

bieblebrox commented 6 months ago

Experiencing the same issue on 4.15.5

Transferring from remote (dev) instance running on Google Cloud Run to local works fine, but transferring from the local to another remote instance (staging) throws this error.

npx strapi transfer --to $STAGING_INSTANCE --to-token $STAGING_TRANSFER_TOKEN
? The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed? Yes
Starting transfer...
✔ entities: 152 transfered (size: 209.1 KB) (elapsed: 8139 ms)
⠙ assets: 0 transfered (size: 0) (elapsed: 0 ms) node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: Request failed with status code 404
    at ClientRequest.<anonymous> (/devpath/node_modules/@strapi/data-transfer/dist/index.js:2245:17)
    at Object.onceWrapper (node:events:632:26)
    at ClientRequest.emit (node:events:517:28)
    at ClientRequest.emit (node:domain:489:12)
    at HTTPParser.parserOnIncomingClient (node:_http_client:700:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:541:22)
    at TLSSocket.emit (node:events:517:28)
    at TLSSocket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:368:12)
Emitted 'error' event on Duplexify instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.19.0

It seems to be an asset transfer issue. I can confirm the Media library is working fine on the staging instance

chrisfernandes102 commented 6 months ago

Are there any updates on this? @bieblebrox I am running into the EXACT same issue here.

alexbudin commented 5 months ago

Same here for latest version of Strapi.

kyguney commented 4 months ago

I've shared the temporary solution in the provided link.