'unable to get local issuer certificate error while trying to retrieve parameter store values using nodejs aws sdk

I am trying to retrieve parameter store values using nodejs sdk.

const ssm = new AWS.SSM({apiVersion:"2014-11-06"})
const result = await ssm.getParameter(params) // omitting other details

When the above code runs, I am getting below issue.

ERROR   Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Netw
orkingError: unable to get local issuer certificate","reason":{"errorType":"NetworkingError","errorMessage":"unable to get local issuer certificate","code":"NetworkingError","messag
e":"unable to get local issuer certificate","region":"us-west-2","hostname":"ssm.us-west-2.amazonaws.com","retryable":true,"time":"2022-01-24T14:52:18.928Z","stack":["Error: unable 
to get local issuer certificate","    at TLSSocket.onConnectSecure (_tls_wrap.js:1515:34)","    at TLSSocket.emit (events.js:400:28)","    at TLSSocket.emit (domain.js:475:12)","   
 at TLSSocket._finishInit (_tls_wrap.js:937:8)","    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:709:12)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: NetworkingError: unable to get local issuer certificate","    at process.<anonymous> (/var/runtime/index.js:35:15)","    at process.emit (events.js:400:28)","    at process.emit (domain.js:475:12)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:96:32)"]}
END RequestId: f46dde15-ba35-4dec-9e35-adf12030fb37

Can anyone guide me on why this error might be coming up and how can I fix this ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source