Skip to main content

npm - Unable to verify first certificate

*WARNING*: Don’t do this at home!

As part of our GraphQL toolchain  we are using graphql-codegen to generate the necessary typescript files from the GraphQL schema and the queries in our application.

GraphQL-codegen is a node.js application that is using graphql-toolkit behind the scenes.

When trying to parse the schema from a site hosted on localhost, the application failed with the following error message;

Unable to verify first certificate

We fixed it by applying a dirty hack:

set NODE_TLS_REJECT_UNAUTHORIZED=0
Never do this on production!