matthew-andrews / isomorphic-fetch

Isomorphic WHATWG Fetch API, for Node & Browserify
MIT License
6.95k stars 289 forks source link

unable to verify the first certificate? #154

Closed sandywk closed 3 years ago

sandywk commented 6 years ago

next.js + isomorphic-fetch

error: request to https://...... failed, reason: unable to verify the first certificate

What should I do?

voor commented 6 years ago

Are you using a self-signed SSL certificate?

lawrezzz commented 6 years ago

what should i do if i am using a self-signed SSL? any override method?

sdgandhi commented 5 years ago

@lawrezzz

const https = require("https");

const options = {
  agent: new https.Agent({
    rejectUnauthorized: false
  })
};

fetch(url, options)
taynguyen commented 4 years ago

In dev or test environment we should set

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

That would solve at env scope.