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
Importing (JSON2) fails with "Cannot read properties of null (reading 'localizations')" #74
Comments
I have encountered the same error when Once I added localization for 1 entry, the import went but, that's not feasible for all entries. In the following example I am getting an error even with localizations present for 2 entries.
|
Hey @mmange @akarelinsbs this is the issue I am currently working on. I made significant progress and I will have a fix by end of next week Feel free to join the discord of the community (see readme) to have the latest updates |
I published version |
I am using
This is just doing a "Quick Actions" export and then trying to import it. |
Can you share the schema of the collection that triggers the issue? |
Here is my import json {
"version": 2,
"data": {
"api::playlist.playlist": {
"139": {
"id": 139,
"title": "Hey",
"slug": "abc-123",
"createdAt": "2022-08-15T03:40:47.967Z",
"updatedAt": "2022-11-14T02:44:49.463Z",
"locale": "en",
"members": [2520],
"createdBy": null,
"updatedBy": null
},
"general.media-element": {
"2520": {
"id": 2520,
"mediaRecord": 1379
}
},
"api::media-record.media-record": {
"1379": {
"id": 1379,
"title": "yo",
"type": "audio",
"videoSource": null,
"slug": "yo-1",
"createdAt": "2022-08-15T03:40:47.876Z",
"updatedAt": "2022-11-14T02:25:35.512Z",
"locale": "en",,
"audioSources": [68],
"createdBy": null,
"updatedBy": null
}
},
"plugin::upload.file": {
"68": {
"id": 68,
"name": "01_01.mp3",
"alternativeText": "01_01.mp3",
"caption": "01_01.mp3",
"hash": "01_01_c9933681c8",
"ext": ".mp3",
"mime": "audio/mpeg",
"url": "https://my-aws.amazonaws.com/01_01_c9933681c8.mp3",
"createdAt": "2022-08-24T07:15:07.707Z",
"updatedAt": "2022-08-24T07:15:07.707Z",
"createdBy": 1,
"updatedBy": 1
}
}
}
}
}
|
@JWesorick the issue I see is that all collections are part of the data of the collection |
🤦🏻 Yea that was it. Correctly formatting the JSON makes it work. |
@JWesorick what did you change to make the JSON formatted correctly? Your snippet passes validation. |
@m-torin you can find an example in the doc in the Importing Data section. Here the issue was the collections were nested in another collection instead of being in the object |
I have a localised instance v4.4.5 with the latest version of Import/Export plugin.
The instance has two languages enabled (Italian & English).
When I try to import the following JSON2 entity
{ "version": 2, "data": { "api::allergen.allergen": { "1": { "id": 1, "name": "Glutine", "description": "Cereali, grano, segale, orzo, avena, farro, kamut, inclusi ibridati e derivati." } } } }
it fails with
"Cannot read properties of null (reading 'localizations')"
error.
The text was updated successfully, but these errors were encountered: