Current behavior
After made a export of the content, trying to import it into another stage/cluster
Reproduction
I had the problem on my own project, but it's also the same for the tutorial:
https://www.prismagraphql.com/docs/tutorials/data-import/export-and-import-caith9teiy
prisma import --data export-2018-01-29T14:56:05.341Z.zip
Unzipping 12ms
Validating data !
▸ Object {"updatedAt":"2018-01-29T14:54:15.000Z","_typeName":"Post","id":"cjd0c4j8v01i50113i2xqc6p4","createdAt":"2018-01-29T14:54:15.000Z","title":"GraphQL is awesome"} lacks the following properties: author
The bug seems to be about relation fields.
Thanks
This is the complete logs:
Unzipping... 11ms
Validating data... !
Error: Object {"updatedAt":"2018-01-29T14:54:15.000Z","_typeName":"Post","id":"cjd0c4j8v01i50113i2xqc6p4","createdAt":"2018-01-29T14:54:15.000Z","title":"GraphQL is awesome"} lacks the following properties: author
at Validator.checkRequiredFields (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/src/commands/import/Validator.ts:311:13)
at Validator.validateNode (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/src/commands/import/Validator.ts:110:10)
at Validator.validateImportData (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/src/commands/import/Validator.ts:88:14)
at Importer.validateFiles (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/src/commands/import/Importer.ts:207:17)
at Importer.<anonymous> (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/src/commands/import/Importer.ts:107:10)
at step (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/dist/commands/import/Importer.js:40:23)
at Object.next (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/dist/commands/import/Importer.js:21:53)
at fulfilled (/Users/xxx/Sites/test/prisma-io/node_modules/prisma-cli-core/dist/commands/import/Importer.js:12:58)
at <anonymous>
Exiting with code: 1
Thanks @johannpinson, I walked through the tutorial and can confirm this behaviour.
This looks to be an overeager validation by the CLI in the case of required to-one relation fields.
The CLI should detect relational fields and should ignore them when validating nodes/000001.json.
Two possible workarounds here:
Tried that actually. I will try it again and document it. Did not seem to go as expected last time.
@idkjs Were you able to successfully import data following either of the workarounds mentioned by @marktani ?
@gihrig changing required field to optional field works. I dont remember what happened with the second suggested solution.
We believe this issue to be fixed by the latest CLI. It would be great if one of you could give it a try before I close this issue 👍
I can confirm this is now fixed.
Getting this exact error in 1.8 -- definitely over-eager validation as I can see the data it is complaining about in the nodes json file. Will try a manual import and report back..
Thanks @steve-a-jones, please let us know if you found a reproduction so we can look into this 🙂
@marktani - Verified that manual import works fine with 1.8.
Does the validation happen in the cli itself or the backend?
The validation happens in the CLI :slightly_smiling_face:
That error message is not a validation error, it is an unexpected error thrown by graphql-js if I remember correctly.
@marktani - Any updates on this bug? Should we re-open this issue?
Still getting this error sporadically -- I don't mind doing manual imports in the meantime but we are trying to minimize the number of custom scripts in our CD flow.
The data import is complaining about actually exists in NDF import data
Have you found a reliable reproduction? if so, please create a new issue including all the necessary information so we can start looking into a fix :slightly_smiling_face: I think that's cleaner than reviving the current thread.