Upstream:2 error - Connection lost
Closed this issue · 3 comments
Hi,
I have implemented the custom form and i'm using the paylike.tokenize(). But sometimes the paylike.js throw an error with "Connection lost"
Is this something that I need to worry about? I can see in network that the gateway.paylike.io return a 400 with a proper response, but my js doesnt seems to work properly
This is my implementation
paylike.tokenize($form, {}, function (err, response) {
if (err) {
console.warn(err); // It takes forever to get in here for some reason? Long time about gateway.paylike.io returns
}
else {
console.log(response, 'success');
}
});
The error only occurs when I'm posting invalid data - like expired card og something like that
I made a discovery myself, and it was somehow my angular that caused the long wait for "console.warn" to trigger.
But I still dont know if the "Connect lost" is a proper response from the JavaScript, or if I am doing something wrong.
Hi @jhavmoeller,
Thanks for reaching out and sorry for the late reply.
Most likely this is due to wrong card information or the like. You should have a detailed error code and message in the HTTP body of the request. You might want to look it up in https://github.com/paylike/processing-errors afterwards.
The browsers are, unfortunately, not that kind to show you the actual http response of a request. One way to circumvent this, and see the real reason behind a failed request, is to use the "copy as cURL" functionality found in most browsers. Add -v
to the command and cURL should be much more helpful for debugging.
Alright - thank you!