Graphql-code-generator: Allow for insecure requests

Created on 28 Jul 2017  ·  5Comments  ·  Source: dotansimha/graphql-code-generator

Hey,

It would be great if we could have a flag to allow for endpoints with self signed certificates or allow us to add our own CA when fetching from a URL.

Most helpful comment

@CarloPalinckx It has changed a long time ago. See: https://github.com/dotansimha/graphql-code-generator/issues/1806

We don't want to allow insecure HTTP connection by default. So if you wish to do that, you can always set this env variables by yourself: NODE_TLS_REJECT_UNAUTHORIZED=0 graphql-codegen

All 5 comments

@Anthonyzou I think we can completely ignore certificated because this is a development tool.
What do you think?

Done in 0.8.11

@dotansimha It looks like there is a regression on this, or I might be doing something wrong?

    ❯ Generate ./xxxxx/src/__generated__/index.tsx
      ✖ Load GraphQL schemas
        → request to https://localhost:4000/ failed, reason: self signed certificate
        Load GraphQL documents
        Generate

My config:

config: &config
  withHooks: true
  withComponent: false
  withHOC: false 
  transformUnderscore: true
  immutableTypes: true
  nonOptionalTypename: true
  apolloReactHooksImportFrom: 'react-apollo-hooks'
  apolloReactCommonImportFrom: 'react-apollo'

plugins: &plugins
  - add: |
      // tslint:disable
      // ⚠️  This file is autogenerated! ⚠️ 
      // Changing this file will end badly, be wary.
  - "typescript"
  - "typescript-operations"
  - "typescript-react-apollo" 

overwrite: true
schema: "https://localhost:4000/"
generates:
  ./xxxxx/src/__generated__/index.tsx:
    documents: "xxxxx/src/**/*.graphql"
    config: *config
    plugins: *plugins
  ./yyyyyy/src/__generated__/index.tsx:
    documents: "yyyyyy/src/**/*.graphql"
    config: *config
    plugins: *plugins

@CarloPalinckx It has changed a long time ago. See: https://github.com/dotansimha/graphql-code-generator/issues/1806

We don't want to allow insecure HTTP connection by default. So if you wish to do that, you can always set this env variables by yourself: NODE_TLS_REJECT_UNAUTHORIZED=0 graphql-codegen

@dotansimha That works just as well, thanks for the quick response ❤️

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mszczepanczyk picture mszczepanczyk  ·  3Comments

jackhkmatthews picture jackhkmatthews  ·  3Comments

fvisticot picture fvisticot  ·  3Comments

iamdanthedev picture iamdanthedev  ·  3Comments

rogerg93 picture rogerg93  ·  3Comments