gdr
gdr

Reputation: 29

SERVERLESS: Error: RequestError: self signed certificate in certificate chain

I am trying to create a serverless project. But it gives an error when giving the serverless command on the cmd. Please help me to solve this.

first I installed the serverless with 'npm install -g serverless' command. Then I gave 'serverless' command. So following error was displayed on the cmd.


C:\Geethma\myFiles\serverlessTutorial>serverless

Creating a new serverless project

? What do you want to make? AWS - Node.js - Starter
? What do you want to call this project? aws-node-project
Environment: win32, node 16.15.0, framework 3.18.2, plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
RequestError: self signed certificate in certificate chain
    at ClientRequest.<anonymous> (C:\Users\geethma.rathnayake\AppData\Roaming\npm\node_modules\serverless\node_modules\got\dist\source\core\index.js:962:111)
    at Object.onceWrapper (node:events:642:26)
    at ClientRequest.emit (node:events:539:35)
    at ClientRequest.emit (node:domain:475:12)
    at ClientRequest.origin.emit (C:\Users\geethma.rathnayake\AppData\Roaming\npm\node_modules\serverless\node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
    at TLSSocket.socketErrorListener (node:_http_client:454:9)
    at TLSSocket.emit (node:events:527:28)
    at TLSSocket.emit (node:domain:475:12)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    at TLSSocket.onConnectSecure (node:_tls_wrap:1532:34)
    at TLSSocket.emit (node:events:527:28)
    at TLSSocket.emit (node:domain:475:12)
    at TLSSocket._finishInit (node:_tls_wrap:946:8)
    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:727:12)

Upvotes: 0

Views: 8916

Answers (2)

Sarath Subramanian
Sarath Subramanian

Reputation: 21301

I had checked with Aaron's answer, but it didn't work for my case.

Issue on my side was with my company's VPN, as it was blocking sending/receiving the data. I went with the below steps that solved my issue.

Solution

  1. Try disabling the VPN.
  2. Run the command again.
  3. Verify if it works.

Also make sure that your IAM user has necessary privileges to perform this by attaching necessary policy in the AWS's IAM User page.

Upvotes: 2

Aaron Stuyvenberg
Aaron Stuyvenberg

Reputation: 3777

If you're using a machine provided by an employer, they may have installed self-signed SSL certificates in order to connect to internal systems or run fleet management software.

You can override strict checking in Node by either prepending the command with NODE_TLS_REJECT_UNAUTHORIZED=0 serverless, or permanently with npm config set strict-ssl false.

Upvotes: 2

Related Questions