braintree / braintree_node

Braintree Node.js library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
335 stars 104 forks source link

Unexpected Error when deploying braintree server on firebase functions #120

Closed ATF19 closed 6 years ago

ATF19 commented 6 years ago

General information

Issue description

On firebase, the app just return an unexpectedError on the error object without specifying an understandable error message. But the weird part is that it works well on my local server (using firebase serve locally).

Here's how i generate a token:

gateway.clientToken.generate({}, function (err, response) {
    if(response)
      res.send({error: false, token: response.clientToken});
    else
      res.send({error: true, errorObj: err, response: response});
  });
crookedneighbor commented 6 years ago

@ATF19 Can you post here what the solution was in case this comes up in the future?

ATF19 commented 6 years ago

The problem wasn't with Braintree SDK, it was with firebase functions policy. It's because firebase limits (and even blocks) the outgoing socket connections to non-Google controlled endpoints. So to solve this i had to change the cloud provider. (Or if you are facing this problem you can upgrade your firebase subscription to the blaze plan)

crookedneighbor commented 6 years ago

Thanks for the info. That's helpful!