Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error 500 while importing when using postgres #113

Closed
rtkac opened this issue Apr 24, 2023 · 9 comments
Closed

[BUG] Error 500 while importing when using postgres #113

rtkac opened this issue Apr 24, 2023 · 9 comments
Assignees

Comments

@rtkac
Copy link

rtkac commented Apr 24, 2023

I can see 500 error response while uploading when using postgres database:
{"data":null,"error":{"status":500,"name":"InternalServerError","message":"Internal Server Error"}}

Body payload:
{"slug":"custom:db","data":"{\n\t\"version\": 2,\n\t\"data\": {\n\t\t\"plugin::upload.folder\": {},\n\t\t\"plugin::upload.file\": {},\n\t\t\"api::test1.test1\": {\n\t\t\t\"1\": {\n\t\t\t\t\"id\": 1,\n\t\t\t\t\"name1\": \"test 1 name\",\n\t\t\t\t\"createdAt\": \"2023-04-24T07:54:55.073Z\",\n\t\t\t\t\"updatedAt\": \"2023-04-24T07:54:55.073Z\",\n\t\t\t\t\"publishedAt\": null,\n\t\t\t\t\"media1\": null,\n\t\t\t\t\"createdBy\": null,\n\t\t\t\t\"updatedBy\": null\n\t\t\t}\n\t\t}\n\t}\n}","format":"json","idField":"id"}

Do you know what could be a problem?

FYI:

  • export works fine
  • "strapi-plugin-import-export-entries" version: 1.19.0
  • "strapi" version: 4.9.2

Thanks!

@Baboo7
Copy link
Owner

Baboo7 commented Apr 24, 2023

@rtkac do you have any server logs?

@rtkac
Copy link
Author

rtkac commented Apr 24, 2023

Hi, here are the server logs:

[2023-04-24 20:32:16.173] http: GET /import-export-entries/import/model-attributes/custom:db (34 ms) 200
[2023-04-24 20:32:19.646] error: Cannot read properties of undefined (reading 'modelType')
TypeError: Cannot read properties of undefined (reading 'modelType')
    at /opt/node_modules/strapi-plugin-import-export-entries/server/services/import/import-v2.js:83:104
    at Array.filter (<anonymous>)
    at extract (/opt/node_modules/strapi-plugin-import-export-entries/libs/arrays.js:27:33)
    at splitSlugs (/opt/node_modules/strapi-plugin-import-export-entries/server/services/import/import-v2.js:83:49)
    at /opt/node_modules/strapi-plugin-import-export-entries/server/services/import/import-v2.js:48:62
    at Generator.next (<anonymous>)
    at /opt/node_modules/strapi-plugin-import-export-entries/server/services/import/import-v2.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/opt/node_modules/strapi-plugin-import-export-entries/server/services/import/import-v2.js:4:12)
    at Object.importDataV2 (/opt/node_modules/strapi-plugin-import-export-entries/server/services/import/import-v2.js:43:74)
    at Object.<anonymous> (/opt/node_modules/strapi-plugin-import-export-entries/server/controllers/admin/import-controller/import-data.js:26:46)
    at Generator.next (<anonymous>)
    at fulfilled (/opt/node_modules/strapi-plugin-import-export-entries/server/controllers/admin/import-controller/import-data.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-04-24 20:32:19.689] http: GET /import-export-entries/import/model-attributes/custom:db (29 ms) 200

@p8ul
Copy link

p8ul commented Apr 25, 2023

I'm getting the same issue. I'm migrating data from Strapi v4.5.2 to v4.90 using strapi-plugin-import-export-entries v1.19.0

@Baboo7
Copy link
Owner

Baboo7 commented Apr 25, 2023

Fixed in 1.19.1

@rtkac
Copy link
Author

rtkac commented Apr 26, 2023

@Baboo7 Thanks!

  1. works fine when I import content for collection type that exists in the admin
  2. doesn't work when I import collection type with content that doesn't exist in the admin

Should work in both situations, right? :D

@Baboo7
Copy link
Owner

Baboo7 commented Apr 26, 2023

Import should work only if the collection type is known by the app. I haven't tested importing data for a collection that hasn't been created before, and actually unknown slugs are ignored

@rtkac
Copy link
Author

rtkac commented Apr 26, 2023

OK thanks. So it looks like it's working now :)

What do you think about this feature mentioned in point 2.? Is it realistic? It will be great to have such a functionality (to import collection type with its data).

@rtkac rtkac closed this as completed Apr 26, 2023
@Baboo7
Copy link
Owner

Baboo7 commented Apr 26, 2023

It looks interesting but it requires a lot of investigation to see how strapi handles the creation of a new collection. Plus a change in how data is exported at the moment, which is not the main blocking part. We'll see how many times this feature will be requested

@hdeadman
Copy link

Regarding the sync of content model along with content, sounds like a bad idea. The content model is code and this is a plugin for moving content. Content model changes should be managed as code (e.g. version control, etc), especially since they are creating tables in a database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants