我正在使用 graphql-request npm 包,以便在我的软件中使用 graphql。 我的代码中有以下行:
const client: GraphQLClient = new GraphQLClient(process.env.OCEAN_ENDPOINT, {});
client.setHeaders({ Authorization: `Bearer: ${token}` });
然后我想触发我使用的请求:
await client.request(query, variables);
直到两天前,我的端点还是一个 http url,但现在它更改为 https,从那一刻起我收到此错误:
FetchError: request to https://{graphqlEndpoint}/v1/graphql failed, reason: unable to verify the first certificate
以前有人遇到过这个问题吗?
最佳答案
NODE_TLS_REJECT_UNAUTHORIZED = "0";
在 env 中添加这个对我在 nextjs 项目中有用
关于node.js - FetchError : graphql failed,原因:无法验证第一个证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71132413/