-
Notifications
You must be signed in to change notification settings - Fork 470
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
apollo codegen:generate did't work. TypeError: Cannot read property 'name' of undefined #678
Comments
FYI> Client packages
Server packages
|
Having the exact same issue. |
Also running into this and unsure how to proceed. |
It works at v1.9.2.... T^T $ apollo codegen:generate src/types/api.d.ts --queries='src/**/*.query.ts' --addTypename --target typescript --outputFlat
› Warning: apollo update available from 1.9.2 to 2.0.8
✔ Loading Apollo config
✔ Scanning for GraphQL queries (0 found)
✔ Generating query files with 'typescript' target - wrote 1 files |
Correct. worked with older version! |
I believe this should have been fixed in the latest versions. Could you try again and see if that works for you? |
@martijnwalraven ❯ yarn codegen
yarn run v1.12.1
$ apollo service:download --endpoint=http://localhost:4000/graphql
✔ Loading Apollo Project
✔ Saving schema to schema.json
$ apollo codegen:generate src/types/api.d.ts --queries='src/**/*.query.ts' --addTypename --target typescript --outputFlat
Error: No provider was created for config
at Object.schemaProviderFromConfig (~/XXXXX/client/node_modules/apollo-language-server/lib/schema/providers/index.js:29:11)
at new GraphQLProject (~/XXXXX/client/node_modules/apollo-language-server/lib/project/base.js:25:43)
at new GraphQLClientProject (~/XXXXX/client/node_modules/apollo-language-server/lib/project/client.js:33:9)
at Generate.createService (~/XXXXX/client/node_modules/apollo/lib/Command.js:96:28)
at Generate.init (~/XXXXX/client/node_modules/apollo/lib/Command.js:32:14)
at <anonymous>
error Command failed with exit code 2. |
Still haven't found a way around this. Get the same "no provider was created for config" error. Should I just be using |
I solved this issue by writing a client configuration following directions on this page: https://www.apollographql.com/docs/references/apollo-config.html |
This still haven't been resolved. Was on latest version (2.1.9), but had to downgrade to 1.9.2. Any updates? |
For those still seeing the issue, can you please provide a reproduction? |
i downloaded the latest version of apollo (apollo@2.4.4) and included in my package.json and ran below commands and it seems to work...
before that, i was trying out different versions of apollo and had encountered the common problems apollo users of earlier versions were facing (eg no provider found, no config file found, fragments operations error etc) |
Sorry, I'm late! "precodegen": "apollo schema:download --endpoint=http://localhost:4000/graphql",
"codegen": "apollo codegen:generate src/types/api.d.ts --localSchemaFile=schema.json --includes='src/**/!(*.local).ts' --target typescript --outputFlat" |
I am trying
codegen:generate
with npm scripts.But I faced error..
Thanks!
The text was updated successfully, but these errors were encountered: