Nodejs Code Related Issues

Bhawani
Occasional Visitor

Nodejs Code Related Issues

Hi Team,

I just created an account with Visa and got project details with credentails. I'm trying to setup Nodejs code on my system but I'm not able to setup it properly because of following issues:

1. package.json file is missing in Nodejs code. I installed packages manually.

2. I set keys and keyFiles in credentails.json as per READ.me file but still getting some errors like 

error {"library":"x509 certificate routines","function":"X509_check_private_key","reason":"key values mismatch","code":"ERR_OSSL_X509_KEY_VALUES_MISMATCH"}

 

I think I had not configured keys and keyFiles in credentails.json. Can you please explain in breif How can I get those keys and in which option I need to configure that.
I'm confused about these options incredentails.json file: cert | ca | key 

3 REPLIES 3
DianaTran
Visa Dev Moderator

Re: Nodejs Code Related Issues

Hey @Bhawani,

 

I'm happy to help you resolve the issue. I'll take a look and get back soon. Please let us know if you have other questions. 



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

Thanks,
Diana

DianaTran
Visa Dev Moderator

Re: Nodejs Code Related Issues

Hi @Bhawani.

 

To follow up, we've logged INC10017609 for the engineering team to investigate the issue and someone will get back soon. Please let us know if you have other questions and someone will be happy to help.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

Thanks,
Diana

DianaTran
Visa Dev Moderator

Re: Nodejs Code Related Issues

Hey @Bhawani,

 

Does the issue persist? What API product are you using? To start, you get this error if the private key you've specified does not match the public key in the certificate you are trying to use. Please check that the private key you use matches the public key in the certificate. This can be done be comparing the output of the following commands which should be the same:

 

openssl x509 -noout -modulus -in your-cert-file.pem
openssl rsa -noout -modulus -in your-key-file.pem

 

If these do not match, then perhaps you have used the wrong file for either your cert or your key files.

 

cert => file you download from the Credentials section of the Portal
key ==> the private key that you downloaded or created when you first created the project
ca ==> on a Mac, you can point to cacerts (if you get a self-signed error, see if commenting this out helps)

 

This worked on NodeJS v 14.15.0 and 15.1.0 (npm 6.14.8, 7.0.8)



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

Thanks,
Diana