Closed GlennGeenen closed 9 years ago
Hi @GlennGeenen. This is most likely a problem with the underlaying transport layer. We use SNI to attach multiple certificates to the same IP-address. I fear that you will need to upgrade your server's node version.
@willemstuursma The module is not compatible with node v0.12.0. I added sample code. This works in node v0.10.37 and not in v0.12.0.
var Mollie = require('mollie-api-node');
var http = require('http');
var mollie = new Mollie.API.Client();
mollie.setApiKey('molliekey');
var pay = {
amount: 10,
description: 'Payment Test',
redirectUrl: 'http://localhost:1337/back'
};
http.createServer(function (req, res) {
if (req.url === '/back') {
res.end('Welcome Back\n');
} else {
mollie.payments.create(pay, function (payment) {
if (payment.error) {
console.error('Payment Error: ' + payment.error);
}
res.writeHead(302, {
Location: payment.getPaymentUrl()
});
return res.end();
});
}
}).listen(1337, '127.0.0.1');
We have the same issue when i upgraded my node version from the 0.10.21 to 0.12.4.
Module is not compatible with new version of node 0.12.4.
I'm still running on v0.10.38 because of this. I'll look into the problem when I have some time since I want to upgrade node.
Thanks, we are going to look into this. If you could provide a PR, that would help immensely.
It seems to crash on reading/loading the certificate. Node v0.12 has SSLv2 and SSLv3 disabled, could that be the problem?
Edit: Not the problem, SSLv2 and SSLv3 are disabled since v0.10.33 and it works on v0.10.38. It all look like something is wrong with the certificate (that's what the errors say). Maybe some of the v0.12 changes to buffer created this problem? How is the certificate created?
Hi, we are also experiencing this. Has this issue been resolved? Is there a work-around?
Hey there. Ive been working on this all day and can't make it work :( If anyone has a work-arund please post greetz,
Voidkn1ghtz
I've also spent some time on it, as far as I understand reading certdata.txt fails in node v0.12 while it works in v0.10. I guess it's a matter of recreating certdata.txt?
certdata.txt? Where can I find this?
Thanks for your quick response, Glenn. But what I don't quite get yet is how I can recreate this file?
Have you tried using the .pem file from our PHP client (https://raw.githubusercontent.com/mollie/mollie-api-php/master/src/Mollie/API/cacert.pem) on Node v0.12?
Place it next to certdata.txt
and change https://github.com/mollie/mollie-api-node/blob/master/lib/mollie/api/client.js#L84
@lvgunst When I use the cacert.pem I can read the certificate and send a create payment request that provides following error:
Payment Error: {"type":"request","message":"Unauthorized request","links":{"documentation":"https://www.mollie.com/en/docs"}
@amirshakya2010, @GlennGeenen, @jasminjane, @daanbrandt: Release 1.0.4 should fix this issue.
The format of the cacert was incorrect but due to the fact that it was also incorrectly the single element of an array this error didn't surface in older versions of node. Older versions would then use the system-installed CA instead which works fine for most of us with a soundly setup system. With node v0.12 the error was no longer silently ignored and so caused the problem. I've corrected the format of the cacert fixed the buggy array use. Now this file is actually used on all versions of node and also prevents the error from happening in node v0.12.
@GlennGeenen "The Unauthorized request" error usually means you're not using valid credentials (api-key).
When I test locally the mollie payment is created just fine and I get redirected to mollie. Whenever I try the same on my test server (Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic x86_64)) I get the following error when I try to create a payment.
The only difference is that my test server runs node v0.12.0 while I run v0.10.33.
Error: error:0906D06C:PEM routines:PEM_read_bio:no start line at Error (native) at Object.createSecureContext (_tls_common.js:130:19) at Object.exports.connect (_tls_wrap.js:850:21) at Agent.createConnection (https.js:82:14) at Agent.createSocket (_http_agent.js:194:16) at Agent.addRequest (_http_agent.js:166:23) at new ClientRequest (_http_client.js:154:16) at Object.exports.request (http.js:49:10) at Object.exports.request (https.js:136:15) at Client.module.exports.Mollie.API.Client.Client.callRest (/var/www/test/node_modules/mollie-api-node/lib/mollie/api/client.js:91:23) at Payments.module.exports.Mollie.API.Resource.Base.Base.create (/var/www/test/node_modules/mollie-api-node/lib/mollie/api/resource/base.js:66:23)
Edit: I installed v0.10.37 on the server, module works for node v0.10 not for v0.12.