Graphcool / graphcool-framework

Apache License 2.0
1.77k stars 131 forks source link

Graphcool export: Cannot read property 'id' of undefined #560

Open ejoebstl opened 6 years ago

ejoebstl commented 6 years ago

When attempting to export a project's data using the graphcool CLI, an uncaught error is thrown:

Please find the output (debug enabled) attached.

graphcool export --target=eu-west-1/cisxzoyjw0jif0141d3fu7kss
  config CWD /home/emi/Projects/authory.net/gc_backup +0ms
  config HOME /home/emi +1ms
  config definitionDir /home/emi/Projects/authory.net/gc_backup +1ms
  config definitionPath null +0ms
  config homepath /home/emi/.graphcoolrc +0ms
  config localRCPath /home/emi/Projects/authory.net/gc_backup/.graphcoolrc +0ms
  config globalRCPath /home/emi/.graphcoolrc +0ms
  cli command id export +0ms
  cli:plugincache Got plugin from cache +0ms
  cli:plugincache /home/emi/.cache/graphcool/plugins.json +0ms
  cli:plugincache Got plugin from cache +1ms
  cli:plugincache /home/emi/.cache/graphcool/plugins.json +0ms
  plugins findCommand graphcool-cli-core +0ms
  plugin requiring command +0ms
  cli-engine:plugins:manager requiring /usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core +0ms
  cli-engine:plugins:manager required +378ms
  plugin required command +380ms
  EnvironmentMigrator graphcoolPath /home/emi/.graphcool does not exist +0ms
TypeError: Cannot read property 'id' of undefined
    at Export.<anonymous> (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/src/commands/export/index.ts:31:52)
    at step (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/export/index.js:42:23)
    at Object.next (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/export/index.js:23:53)
    at fulfilled (/usr/local/lib/node_modules/graphcool/node_modules/graphcool-cli-core/dist/commands/export/index.js:14:58)
    at <anonymous>
Exiting with code: 1

Expected behavior:

Should not crash.

baerrach commented 5 years ago

Do you have a graphcool.yml and maybe types.graphql in that directory?

We were getting the same error when the only files in the directory were the .graphqlrc file defining the server. By putting in the other files it magically started working.

tyholby commented 5 years ago

@ejoebstl I know I'm stupid for making this mistake, but I just got this error by running the graphcool export command in my frontend repo instead of my graphcool backend repo.. haha. Maybe that will help, maybe not.