prisma export fails when no data is stored
Current behavior
prisma export fails.
Reproduction
$ prisma init hello-world
? How to set up a new Prisma service?
Running $ graphql create ...
? Choose GraphQL boilerplate project: node-basic Basic GraphQL server (incl. database)
[graphql create] Downloading boilerplate from https://github.com/graphql-boilerplates/node-graphql-server/archive/master.zip...
[graphql create] Installing node dependencies for /home/marco/projects/anf/inventory/prototype2/hello-world/package.json...
yarn install v1.3.2
warning package.json: No license field
warning graphql-boilerplate: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "graphql-yoga > [email protected]" has unmet peer dependency "aws-lambda@^0.1.2".
warning "prisma-binding > [email protected]" has incorrect peer dependency "graphql@^0.11.0".
warning "graphql-cli > [email protected]" has unmet peer dependency "express@^4.16.2".
warning "prisma > prisma-cli-core > graphql-cli > [email protected]" has unmet peer dependency "express@^4.16.2".
[4/4] Building fresh packages...
Done in 2.78s.
[graphql create] Installing node dependencies for /home/marco/projects/anf/inventory/prototype2/hello-world/.install/package.json...
yarn install v1.3.2
warning package.json: No license field
warning ../package.json: No license field
warning [email protected]: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "[email protected]".
[4/4] Building fresh packages...
Done in 0.17s.
[graphql create] Running boilerplate install script...
Running $ prisma deploy...
? Please choose the cluster you want to deploy "hello-world@dev" to
Added cluster: local to prisma.yml
Creating stage dev for service hello-world ✔
Deploying service `hello-world` to stage `dev` on cluster `local` 64ms
Changes:
Post (Type)
+ Created type `Post`
+ Created field `id` of type `GraphQLID!`
+ Created field `isPublished` of type `Boolean!`
+ Created field `title` of type `String!`
+ Created field `text` of type `String!`
+ Created field `updatedAt` of type `DateTime!`
+ Created field `createdAt` of type `DateTime!`
Applying changes 1.5s
Hooks:
Writing database schema to `src/generated/prisma.graphql` 46ms
Running $ graphql prepare...
Your GraphQL database endpoint is live:
HTTP: http://localhost:4466/hello-world/dev
WS: ws://localhost:4466/hello-world/dev
Next steps:
1. Change directory: `cd hello-world`
2. Start local server and open Playground: `yarn dev`
$ cd hello-world/
$ prisma export
Downloading nodes !
â–¸ Cannot read property 'jsonElements' of undefined
Get in touch if you need help: https://www.graph.cool/forum
To get more detailed output, run $ export DEBUG="*"
Reply
Bookmark
Expected behavior?
prisma export is expected to work.
Thanks for the report @marcovc. You should be able to add a node and then do prisma export to work around this issue 🙂
No, sorry. I just added a post using the playground, and then retried prisma export and obtained the same error.
Note the set of warnings above about "unmet dependencies" on "prisma init". Could it possibly be related?
You're right, I can reproduce this myself.
Here's the debug output from the local cluster:
Downloading nodes... client Downloading from http://localhost:4466/export/dev/export +0ms
client {"fileType":"nodes","cursor":{"table":0,"row":0,"field":0,"array":0}} +1ms
Exporter { code: 3016,
Exporter requestId: 'api:api:cjcvqky9s02n401796izv1fsk',
Exporter error: 'Project not found: \'export~dev@export\'' } +413ms
!
TypeError: Cannot read property 'jsonElements' of undefined
at Exporter.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/src/commands/export/Exporter.ts:126:25)
at step (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/export/Exporter.js:32:23)
at Object.next (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/export/Exporter.js:13:53)
at fulfilled (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/export/Exporter.js:4:58)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
I'm also having troubles importing (that was what led me to try exporting first), perhaps it is related...
Thanks a lot for your help @marcovc! I digged deeper, and I believe the issue to be this one: #1743. I'll wait until this is fixed and will revisit the issue you've raised afterwards.
Is there any workaround for me at the moment?
I was able to modify my local installation of prisma, and force it to download docker image 1.0.1 instead of 1.0 (according to the issue you mentioned). It works now. Thanks
@marcovc how did you do this? I'm having the same issue
@ramsaylanier I had to edit this file:
/usr/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/local/docker/docker-compose.yml
since I have prisma installed globally. I guess it should be
./node_modules/prisma/node_modules/prisma-cli-core/dist/commands/local/docker/docker-compose.yml
in case you have it locally installed.
Search for
prisma-database:
image: prismagraphql/prisma:1.0.1
Awesome! Works now. Thanks @marcovc
Update Prisma to the latest 1.0.10 version, at least "prisma playground" works.
This is fixed in the latest release, please run npm install -g prisma and prisma local upgrade, and ensure that you're on 1.1.x using prisma cluster list.