prisma-labs / get-graphql-schema

Fetch and print the GraphQL schema from a GraphQL HTTP endpoint. (Can be used for Relay Modern.)
669 stars 62 forks source link

Does not support invalid SSL certificates #14

Open theogravity opened 7 years ago

theogravity commented 7 years ago

Needs to have an option to enable this for local dev purposes

  process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'
{ FetchError: request to https://localhost:3045/dev/graphql failed, reason: unable to verify the first certificate
    at ClientRequest.<anonymous> (/Users/t.gravity/.nvm/versions/node/v8.9.1/lib/node_modules/get-graphql-schema/node_modules/node-fetch/index.js:133:11)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'FetchError',
MartinDawson commented 6 years ago

"get-schema:dev": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 graphql get-schema dev",

LucasCalazans commented 3 years ago

Using the @MartinDawson idea, we can use the same strategy on CLI

npm install -g get-graphql-schema
NODE_TLS_REJECT_UNAUTHORIZED=0 get-graphql-schema GRAPHQL_ENDPOINT > schema.graphql