Data import fatal error on 4.6.0

System Information
  • Strapi version: 4.6.0
  • Operating System: Windows 10 22H2
  • Database: SQLite
  • Node Version: 16.14.0
  • NPM Version: 8.3.1

Hello everyone :slight_smile:

I’m trying the new DEITS feature which rolled out in 4.6.0.

I’ve created two strapi apps locally, app1 and app2, which contains the exact same content-types.
(A single type named “Test” with a single “text” field).
I’m using SQLite.

I created two instance of this content-type in app1.
Then exported the data successfully using:
npm run strapi export -- --file test --no-encrypt

I tried to import the archive to app2 using the following command:
npm run strapi import -- -f test.tar.gz

And I always get this error:

I assumed that the content-types were not the same between my two strapi instances. As source and target schemas must match, I also exported the data of app2 in order to compare the two “schemas_00001.jsonl” files to see if there is any differences between the two schemas, but the two files are identical.

Any ideas about why I’m getting this error ?

Thanks :slight_smile:

2 Likes

I have the same issue, the devs are looking into it as far as I can understand. Made a bug report here.

2 Likes

have teh same issue too

Please, @Skwall @niklas @Plussun , could you provide an archive with your project code? It could help us a lot in debugging this issue.

1 Like

I’m experiencing a similar issue. I get the same initial error message, but then for each entity I get a different error message:

- admin::permission:
  -  exists in destination schema but not in source schema
- admin::user:
  -  exists in destination schema but not in source schema
- admin::role:
  -  exists in destination schema but not in source schema
- admin::api-token:
  -  exists in destination schema but not in source schema
- admin::api-token-permission:
  -  exists in destination schema but not in source schema
- plugin::upload.file:
  -  exists in destination schema but not in source schema
...

I have even tried importing in the same strapi app from which I have exported and it failed on all entities.

Here’s the archive with my project code:

Included in the archive:

  • backup/backup_test.tar.gz - the backup file from which I tried to import
  • import_error_log_1676583740176.log - the error log of the failed import

Steps to reproduce:

  1. Unpack the archive on a windows machine (I haven’t tried it on Linux)

  2. Run:

    yarn install

  3. Run:

    yarn strapi export --no-encrypt -f backup/backup

  4. Run:

    yarn strapi import -f backup/backup.tar.gz

My environment:

  • OS: Windows 11 Pro
  • node 16.9.0
  • yarn 1.22.19

Hi,

We are also facing issues while importing data.
If we are using from CLI, we are getting the following error

error: [FATAL] Invalid schema changes detected during integrity checks (using the strict strategy). Please find a summary of the changes below:

  • admin::permission:
    • Removed “”
  • admin::user:
    • Removed “”
  • admin::role:
    • Removed “”
  • admin::api-token:
    • Removed “”
  • admin::api-token-permission:
    • Removed “”
  • plugin::upload.file:
    • Removed “”
  • plugin::upload.folder:
    • Removed “”
  • plugin::i18n.locale:
    • Removed “”
  • plugin::users-permissions.permission:
    • Removed “”
  • plugin::users-permissions.role:
    • Removed “”
  • plugin::users-permissions.user:
    • Removed “”
  • api::about.about:
    • Removed “”
  • api::award.award:
    • Removed “”
  • api::blog-category.blog-category:
    • Removed “”
  • api::case-study.case-study:
    • Removed “”
  • api::codeclouds-sale.codeclouds-sale:
    • Removed “”
  • api::corporate-social-responsibility.corporate-social-responsibility:
    • Removed “”
  • api::customer-support.customer-support:
    • Removed “”
  • api::global.global:
    • Removed “”
  • api::hire-talent.hire-talent:
    • Removed “”
  • api::home.home:
    • Removed “”
  • api::how-it-work.how-it-work:
    • Removed “”
  • api::inclusive-diversity.inclusive-diversity:
    • Removed “”
  • api::office-location.office-location:
    • Removed “”
  • api::partner.partner:
    • Removed “”
  • api::partners-directory.partners-directory:
    • Removed “”
  • api::vetting-process.vetting-process:
    • Removed “”
  • common.team-details:
    • Removed “”
  • common.team-skills:
    • Removed “”
  • shared.seo:
    • Removed “”

If we use a plugin then we are getting the message

Forbidden: You don’t have permission to write this data type.

You should also copy the contents of the api folder to the new project. It helped me

my error is same on import and even on transfer
i have tried copying src
and even git clone for schema…does anyone solved it ?

fixed: Fatal error on import: Invalid schema changes detected during integrity checks

I have solved by editing a file in
node_modules\@strapi\data-transfer\lib\file\providers\source\index.js
on Line 144: const parts = path_1.default.relative('.', filePath).split(\\');
this problem was arising on windows because :

On Windows, file paths typically use backslashes as the path separator, whereas on Unix-based systems (such as macOS and Linux), file paths typically use forward slashes.
so filePath is schema/filename.jsonl in Line 144 split method search for / but something like schema\filename.jsonl is returned by path_1.default.relative() so filter never returns true, now it is splitting by \ and parts = [‘schema’,‘filename.jsonl’];

I have created a pull requested in which issue is [fixed]

2 Likes

Shouldn’t you use path.sep instead of '\\'?

const parts = path.relative('.', filePath).split(path.sep);

Thanks for the fix and looking into it let me get somone from strapi to look into this and get this pr merged and hopfully pushed as as soon as posible.

yess… this will work for bith unix and windows

I can confirm for me the fix suggested by @Priyanshu_Singh worked.

I changed to:

            const parts = path_1.default.relative('.', filePath).split(path_1.default.sep);

and just to be sure, at another part in the same file, line 99:

                const parts = filePath.split(path_1.default.sep);

@Priyanshu_Singh, you might want to add the TS equivalent of this too in your pull request.

In general, whenever path operations are made path.sep should be used. A quick code search suggests there might be other places in the code where the same should be fixed.

I did replace those lines and it did Not work.

I have the same issue, but in the linux, when I do an export from windows machine, I can not import the data in the linux machine, have you any solution?

What version of strapi are you using?

Correction, the fix suggested by @Priyanshu_Singh works partially. When I apply it, I can export the data on windows machine, but cannot import it on a linux machine. Seems this is a more complex issue o fix. For now, I’ve circumvented it by doing the export on linux via docker.

Importing only works if you export/import from the same machine.
If i try to restore the postgres db then i won’t have the media files.

So how can i use back/restore in strapi?

1 Like