question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to get local issuer certificate when fetching CSRF token

See original GitHub issue

Hello, I am trying to use the SAP Cloud SDK to create Purchase Requisitions. I am using the following code:

let builder = purchaseReqService
            .PurchaseRequisitionHeader
            .requestBuilder()
            .create(payload)
            .addCustomQueryParameters({'sap-client': 123})
            return await builder
            .execute({url: baseUrl});

When executing this code the request will fail when fetching the CSRF token:

Error: unable to get local issuer certificate

I can workaround this problem by using isTrustingAllCertificates. This is not what I want however. I had a similar issue in the past and was able to fix it by overwriting the CA certificates used by the http agent.

I saw that you are using axios as an underlying library and allow passing of custom request configurations to it. So I tried overwriting the httpsAgent.

let builder = purchaseReqService
            .PurchaseRequisitionHeader
            .requestBuilder()
            .create(payload)
            .addCustomQueryParameters({'sap-client': 123})
            .addCustomRequestConfiguration({httpsAgent: new https.Agent({
                ca: rootCAs,
              })})
            return await builder
            .execute({url: baseUrl});

This did not help however and I still receive the error above. I cannot figure out how to proceed. Do you any idea?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jjtang1985commented, Sep 1, 2021

@artemkovalyov , FYI. I guess this is a rather quick win.

1reaction
jjtang1985commented, Sep 8, 2021

Hi @JulianGlattki ,

Thanks for your feedback. We will release a new minor version hopefully soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install error - unable to get local issuer certificate
Open up dev tools and go to Security-> View Certificate. Check Certification path and make sure your at the top level certificate, if...
Read more >
Solved: SSL Error: Unable to get local issuer certificate
Solved: I am using Postman to test the 2-ways SSL and it failed with "Error: unable to get local issuer certificate" What does...
Read more >
unable to get local issuer certificate" error. What am I missing?
The error "Unable to get local issuer certificate" is caused by a misconfiguration of the SSL certificate on your machine. An SSL certificate...
Read more >
Issues with CSRF token and how to solve them - SAP Blogs
4th issue – You are sending files to SAP Gateway using sap.ui.commons.FileUploader and you are getting 403 HTTP response – CSRF token validation ......
Read more >
Need some assistance, started getting an error on our local ...
Created a new Connector running on https and we are getting certificate errors: Service error: Error: unable to get local issuer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found