request, error: Unable to verify first certificate


Mr D

I want to make a simple POST HTTP request by using the requestmodule :

var request = require("request");
var form = {form: {some: "form", attributes: "attrs"}}
request.post("https://example.com", form)
   .on('response', function(response) {

   if (response.statusCode === 200) {
     console.log("DONE");
   } else {
     console.log("FAIL");
   }
});

When I start this code it throws me this error message:

Error: unable to verify the first certificate
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1057:38)
at emitNone (events.js:67:13)
at TLSSocket.emit (events.js:166:7)
at TLSSocket._finishInit (_tls_wrap.js:596:8)

I think this happens because the url has https, but I don't know how to fix this error.

How to disable checking certificates?

Michelle

Added "rejectUnauthorized": falseas options:

request.post({url: "https://example.com", "rejectUnauthorized": false}, form)
   .on('response', function(response) {

   if (response.statusCode === 200) {
     console.log("DONE");
   } else {
     console.log("FAIL");
   }
});

or add the appropriate certificate via https://www.npmjs.com/package/ssl-root-cas

require('ssl-root-cas').inject();

Related


request, error: Unable to verify first certificate

Mr D I want to make a simple POST HTTP request using the requestmodule : var request = require("request"); var form = {form: {some: "form", attributes: "attrs"}} request.post("https://example.com", form) .on('response', function(response) { if (response

request, error: Unable to verify first certificate

Mr D I want to make a simple POST HTTP request using the requestmodule : var request = require("request"); var form = {form: {some: "form", attributes: "attrs"}} request.post("https://example.com", form) .on('response', function(response) { if (response

request, error: Unable to verify first certificate

Mr D I want to make a simple POST HTTP request using the requestmodule : var request = require("request"); var form = {form: {some: "form", attributes: "attrs"}} request.post("https://example.com", form) .on('response', function(response) { if (response

request, error: Unable to verify first certificate

Mr D I want to make a simple POST HTTP request using the requestmodule : var request = require("request"); var form = {form: {some: "form", attributes: "attrs"}} request.post("https://example.com", form) .on('response', function(response) { if (response

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate

Chris Seymour I have a directory with certificate bundles, Python scripts and Node scripts. Both scripts make GET requests to the same URL and provide the same certificate bundle. The Python script makes the request as expected, but the node script throws this

Unable to verify first certificate in nodejs

Singh Why does this error occur? Can someone tell me what is the solution for this? If I create a new project using npm init command. UNABLE_TO_VERIFY_LEAF_SIGNATURE error on run Singh you can use this command npm config set strict-ssl false It just disables

NGINX - Unable to verify first certificate

Safek I have Nextcloud (21.0.3) and Onlyoffice Documents Server (6.3.2.2) installed on the same server without docker. I only use nginx as a webserver. The SSL certificate is from European SSL. Nextcloud and Document Server they have different domain names ->

Node error on Heroku instance: Unable to verify first certificate

Tyler Harden I am trying to run an API provided via heroku. Currently I'm using SSL encryption and I've added it to the site via the panel domains and certificatesin the Settings page . While I can connect to the site on the browser using https and postman, I

Node error on Heroku instance: Unable to verify first certificate

Tyler Harden I am trying to run an API provided via heroku. Currently, I'm using SSL encryption and I've added it to the site via the panel domains and certificatesin the Settings page . While I can connect to the site on the browser using https and postman, I

Node error on Heroku instance: Unable to verify first certificate

Tyler Harden I am trying to run an API provided via heroku. Currently, I'm using SSL encryption and I've added it to the site via the panel domains and certificatesin the Settings page . While I can connect to the site on the browser using https and postman, I

Node error on Heroku instance: Unable to verify first certificate

Tyler Harden I am trying to run an API provided via heroku. Currently, I'm using SSL encryption and I've added it to the site via the panel domains and certificatesin the Settings page . While I can connect to the site on the browser using https and postman, I

Node error on Heroku instance: Unable to verify first certificate

Tyler Harden I am trying to run an API provided via heroku. Currently, I'm using SSL encryption and I've added it to the site via the panel domains and certificatesin the Settings page . While I can connect to the site on the browser using https and postman, I

Node error on Heroku instance: Unable to verify first certificate

Tyler Harden I am trying to run an API provided via heroku. Currently, I'm using SSL encryption and I've added it to the site via the panel domains and certificatesin the Settings page . While I can connect to the site on the browser using https and postman, I

Failed to verify first certificate; NodeJs with Python request

Jesse Aldridge I'm trying to make an http request to stackshare.io from NodeJs: var https = require('https'); var options = { host: 'www.stackshare.io', }; https.get(options, function (http_res) { var data = ""; http_res.on("data", function (chunk)

Unable to verify first certificate in Node.js

Sideeq Youssef I have a Nodejs API which uses ssl and https, so I am trying to use it on another server to build a web application using express-js. I get the following error when making a GET request: events.js:141 throw er; // Unhandled 'error' event

Unable to verify first certificate in Node.js

Sideeq Youssef I have a Nodejs API which uses ssl and https, so I am trying to use it on another server to build a web application using express-js. I get the following error when making a GET request: events.js:141 throw er; // Unhandled 'error' event