Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FetchError: graphql failed, reason: unable to verify the first certificate

i'm using the graphql-request npm package in order to use graphql in my software. i have the following line in my code:

const client: GraphQLClient = new GraphQLClient(process.env.OCEAN_ENDPOINT, {});
client.setHeaders({ Authorization: `Bearer: ${token}` });

and then i want to fire a request i use:

await client.request(query, variables);

until two days ago my endpoint was an http url, but now it changed to https and from that moment i'm getting this error:

FetchError: request to https://{graphqlEndpoint}/v1/graphql failed, reason: unable to verify the first certificate

has anyone faced this issue before?

like image 621
Tomer Elkayam Avatar asked Oct 22 '25 15:10

Tomer Elkayam


1 Answers

NODE_TLS_REJECT_UNAUTHORIZED = "0";

adding this in env worked for me in nextjs project

like image 103
Sakhawat Hossain Avatar answered Oct 25 '25 06:10

Sakhawat Hossain