Export error after importing a backup tar.gz

System Information
  • Strapi Version: 4.12.5
  • Operating System: Linux
  • Database: Mysql
  • Node Version: 18.17.1
  • NPM Version: 9.6.7
  • Yarn Version: 1.22.19

Hi everyone,
i’m facing an error after importing a backup file created by “yarn strapi export --no-encrypt --file my-strapi-export” … see trace below: input: ‘/uploads/tca_hb_de6f6d7a7f.mp4’, code: ‘ERR_INVALID_URL’

I can also see that the root folder of “Media Library” is not in sync with the “uploads” folder after the import…only 7 assets out of approx 100 assets. The “folder” are looking ok.

Can someone help? thanks!

Command: yarn strapi import -f my-strapi-export.tar.gz

$ strapi export --no-encrypt --file my-strapi-export1
Starting export…

  • schemas: 0 transfered (size: 0) (elapsed: 0 ms)
    (node:82) Warning: [deprecated] In future versions, Strapi will stop reading directly from the environment variable API_TOKEN_SALT. Please set apiToken.salt in config/admin.js instead.
    For security reasons, keep storing the secret in an environment variable and use env() to read it in config/admin.js (ex: apiToken: { salt: env('API_TOKEN_SALT') }). See Environment variables | Strapi Documentation.
    (Use node --trace-warnings ... to show where the warning was created)
    (node:82) Warning: Missing transfer.token.salt: Data transfer features have been disabled.
    Please set transfer.token.salt in config/admin.js (ex: you can generate one using Node with crypto.randomBytes(16).toString('base64'))
    For security reasons, prefer storing the secret in an environment variable and read it in config/admin.js.
    :heavy_check_mark: schemas: 42 transfered (size: 42.8 KB) (elapsed: 12 ms)
  • entities: 0 transfered (size: 0) (elapsed: 0 ms)
    :heavy_check_mark: entities: 411 transfered (size: 363.8 KB) (elapsed: 162 ms)
  • assets: 0 transfered (size: 0) (elapsed: 0 ms)
    node:events:492
    throw er; // Unhandled ‘error’ event
    ^

TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:405:5)
at new URL (node:internal/url:611:13)
at request (node:https:346:32)
at Object.get (node:https:392:15)
at /opt/node_modules/@strapi/data-transfer/dist/strapi/providers/local-source/assets.js:35:14
at new Promise ()
at getFileStats (/opt/node_modules/@strapi/data-transfer/dist/strapi/providers/local-source/assets.js:33:12)
at generator (/opt/node_modules/@strapi/data-transfer/dist/strapi/providers/local-source/assets.js:66:33)
at async next (node:internal/streams/from:85:11)
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) {
input: ‘/uploads/tca_hb_de6f6d7a7f.mp4’,
code: ‘ERR_INVALID_URL’
}

Node.js v18.17.1
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.

did you find a solution to this?

Im getting:

✔ entities: 224 transfered (size: 102 KB) (elapsed: 3311 ms)
⠧ assets: 4 transfered (size: 84.9 KB) (elapsed: 1182 ms) (71.8 KB/s)node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: Request failed with status code 404
    at ClientRequest.<anonymous> (D:\Devbox\cbs\ticketland-ts\node_modules\@strapi\data-transfer\dist\index.js:2245:17)     
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:513:28)
    at ClientRequest.emit (node:domain:489:12)
    at HTTPParser.parserOnIncomingClient (node:_http_client:701:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:542:22)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324: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.16.0
1 Like

Same here. This needs to be investigated.

Quick update: i’ve started to fix it manually by deleting the error causing assets from the database (delete from files where id=<id_of_asset>)
but then during an import on another maschine i’m getting:

assets: 301 transfered (size: 61.6 MB) (elapsed: 111113 ms) (567.8 KB/s)[2023-11-17 15:23:01.143] error: [ERROR] Error while uploading asset Platzwart_2_692ed520ea.png TypeError: Cannot set properties of null (setting ‘url’)

Somehow the property “url” gets lost but its filled in the DB

???

@gregg-cbs,

Did you find the solution for this ? I’m getting the same error whenever I try to export. Can someone please help me here?

I’m using “strapi-provider-upload-azure-storage” plugin to upload files from media library to azure. All the uploads are working fine but if I run the below command I have the same issue as you.

command: npm run strapi export – --no-encrypt

Error Trace:

Starting export…
:heavy_check_mark: schemas: 17 transfered (size: 23 KB) (elapsed: 8 ms)
⠙ assets: 0 transfered (size: 0) (elapsed: 0 ms) node:events:491
throw er; // Unhandled ‘error’ event
^

Error: Request failed with status code 404
at ClientRequest. (C:\Users\samuel\Documents\Projects\Test\node_modules@strapi\data-transfer\dist\index.js:2245:17)
at Object.onceWrapper (node:events:628:26)
at ClientRequest.emit (node:events:513:28)
at ClientRequest.emit (node:domain:489:12)
at HTTPParser.parserOnIncomingClient (node:_http_client:701:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:542:22)
at TLSSocket.emit (node:events:513:28)
at TLSSocket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324: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)

According to someone at strapi this is a known error due to some reason - maybe a plugin - i cant remember what it was. I gave up on backing up :confused: