For Create React App (where this error occurs too and this question is the #1 Google result), you are probably using HTTPS=true npm start
and a proxy
(in package.json
) which goes to some HTTPS API which itself is self-signed, when in development.
If that's the case, consider changing proxy
like this:
"proxy": {
"/api": {
"target": "https://localhost:5001",
"secure": false
}
}
secure
decides whether the WebPack proxy checks the certificate chain or not and disabling that ensures the API self-signed certificate is not verified so that you get your data.