get-graphql-schema icon indicating copy to clipboard operation
get-graphql-schema copied to clipboard

Does not support invalid SSL certificates

Open theogravity opened this issue 7 years ago • 2 comments

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',

theogravity avatar Nov 12 '17 03:11 theogravity

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

MartinDawson avatar Feb 25 '18 18:02 MartinDawson

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

LucasCalazans avatar Sep 21 '21 20:09 LucasCalazans