Graphql-code-generator: 1.8.3 Broke loading schema from URL (with env variables)

Created on 5 Nov 2019  ·  4Comments  ·  Source: dotansimha/graphql-code-generator

Describe the bug
As of 1.8.3 now get error when trying to introspect from url with env variables

✔ Parse configuration
  ❯ Generate outputs
    ❯ Generate ./packages/server/src/<thing>.ts
      ✖ Load GraphQL schemas
        → Failed to load schema
        Load GraphQL documents
        Generate


 Found 1 error

  ✖ ./packages/server/src/<thing>.ts
    Failed to load schema from [object Object]:

    undefined
    undefined

    GraphQL Code Generator supports:
      - ES Modules and CommonJS exports (export as default or named export "schema")
      - Introspection JSON File
      - URL of GraphQL endpoint
      - Multiple files with type definitions (glob expression)
      - String in config file

    Try to use one of above options and run codegen again.
    Error: Failed to load schema
        at Object.exports.loadSchema (<__dirname>/node_modules/@graphql-codegen/cli/dist/common
js/load.js:75:15)
    Error: Failed to load schema
        at Object.exports.loadSchema (<__dirname>/node_modules/@graphql-codegen/cli/dist/common
js/load.js:75:15)

To Reproduce
Steps to reproduce the behavior:

  1. My codegen.yml config file:
schema:
  - https://${PRIVATE_APP_DOMAIN}/admin/api/2019-10/graphql.json:
      headers:
        X-Shopify-Access-Token: ${PRIVATE_APP_PASSWORD}
# ...

Expected behavior

In <1.8.3 worked fine

Environment:

  • OS: Linux
  • NodeJS: 12.11

Additional context

bug core waiting-for-release

All 4 comments

@qw-in Could you try with the following canary version?
1.8.4-alpha-40191ca5.21+40191ca5

@ardatan this fixed it for me, thanks :+1:

Let’s keep it open until we release a new version :)

Fixed in 1.9.0

Was this page helpful?
0 / 5 - 0 ratings