durango / authorize-net-cim

Authorize.net CIM bindings for Node.JS
14 stars 5 forks source link

getting error 'CERT_UNTRUSTED'.. #1

Closed mayur07 closed 10 years ago

mayur07 commented 10 years ago

when i call createcustomerprofile method, that time create a profile on website succesfully, but i m getting an error that 'CERT_UNTRUSTED'. so that why in reponce getting null.

durango commented 10 years ago

What version are you using?

durango commented 10 years ago

Also, you have to explicitly define a cert:

https://github.com/durango/authorize-net-request/blob/master/lib/index.js#L11

Authorize.net definitely requires this for obvious reasons :)

joseym commented 10 years ago

I'm getting the same, while developing locally in sandbox mode ... naturally i have a cert in production but I dont for local development.

joseym commented 10 years ago

This looks to be an issue with dependancies ...

authorize-net-cim/package.json#27 says that it should install auth-net-request#1.0.0 while the most current version of auth-net-request appears to be 0.2.1 according to the package specification: authorize-net-request/package.json#L3

Looking at what is installed via the dependancies and what exists on https://github.com/durango/authorize-net-request it's obvious we're not getting the proper version.

authorize-net-request version 0.2.1 appears to let you pass in a config option for cert (https://github.com/durango/authorize-net-request/blob/master/lib/index.js#L11) which you could set to false to bypass the certificate check in sandbox...

joseym commented 10 years ago

@mayur07 I managed to get around this with npm-shrinkwrap

I created a file parallel to my packages.json called npm-shrinkwrap.json and defined the dependancies as such:

{
  "name": "myProject",
  "version": "0.1.0",
  "dependencies": {
    "auth-net-cim": {
      "version": "1.0.3",
      "from": "auth-net-cim@1.0.3",
      "dependencies": {
        "auth-net-request": {
          "version": "0.2.1",
          "from": "auth-net-request@0.2.1"
        }
      }
    }
  }
}

I then removed auth-net-cim via npm uninstall auth-net-cim --save and added it back with npm install auth-net-cim.

Node checks shrinkwrap upon installation and will use the dependencies you define when building.


Now when I build my cim request I can pass false as cert:

cim = new authnetCim({
          api: payConfig.login
        , key: payConfig.key
        , sandbox: true
        , cert: false
      });

I no longer get CERT_UNTRUSTED as an error from AuthNet.

mayur07 commented 10 years ago

@durango While deploying your npm module we are getting the following error :

Error: SELF_SIGNED_CERT_IN_CHAIN

Please help.

durango commented 10 years ago

Closing this issue, you need a valid PEM key and there was a bug fix with OpenSSL in Node .10.29, if you set the cert to false and ignore it you should be fine, but this issue isn't really related to this library specifically.