braintree / braintree_node

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

Crash "Request path contains unescaped characters" in "gateway.transaction.sale" #142

Closed vorti2 closed 6 years ago

vorti2 commented 6 years ago

General information

Issue description

If I call

    return gateway.transaction.sale({
      amount: paymentAmount.toString(),
      paymentMethodNonce: paymentNounce,
      options: {
        submitForSettlement:
        env.braintreeSubmitForSettlement,
      },
    }).then((result) => {
      if (result.success) {
        console.log(`Transaction ID: ${result.transaction.id}`);
        return { paymentStatus: 'Success', transactionData: result.transaction };
      }
      console.error(result.message);
      return { paymentStatus: 'ErrorInSale', message: result.message };
    }).catch((err) => {
      console.error(err);
      return { paymentStatus: 'ErrorCatch', message: err.message };
    });

with the amount 10.00 and a generated nounce (both are string values) on our AWS based server an error message occurs:

error: TypeError: Request path contains unescaped characters
at new ClientRequest (_http_client.js:125:13)
at Object.request (http.js:39:10)
at Object.request (https.js:239:15)
at Promise (/app/node_modules/braintree/lib/braintree/http.js:82:31)
at Promise (<anonymous>)
at Http.request (/app/node_modules/braintree/lib/braintree/http.js:81:12)
at Http.<anonymous> (/app/node_modules/@braintree/wrap-promise/wrap-promise.js:17:33)
at Http.post (/app/node_modules/braintree/lib/braintree/http.js:46:17)
at Http.<anonymous> (/app/node_modules/@braintree/wrap-promise/wrap-promise.js:17:33)
at TransactionGateway.create (/app/node_modules/braintree/lib/braintree/transaction_gateway.js:33:30)
at TransactionGateway.<anonymous> (/app/node_modules/@braintree/wrap-promise/wrap-promise.js:17:33)
at TransactionGateway.sale (/app/node_modules/braintree/lib/braintree/transaction_gateway.js:79:17)
at TransactionGateway.<anonymous> (/app/node_modules/@braintree/wrap-promise/wrap-promise.js:17:33)
at Object._callee$ (/app/src/helpers/Braintree.js:27:31)
at tryCatch (/app/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/app/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/app/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/app/src/helpers/Braintree.js:3:191)
at /app/src/helpers/Braintree.js:3:437
at Promise (<anonymous>)
at Object.<anonymous> (/app/src/helpers/Braintree.js:3:99)
at Object.doPayment (/app/src/helpers/Braintree.js:24:1)
at _callee2$ (/app/src/routes/payments.js:63:24)
at tryCatch (/app/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/app/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/app/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)

In a local server I have not this problem, I can make successful payments.

Any tips and suggestions?

Kind Regards,

Wilhelm

Epreuve commented 6 years ago

It looks like you're working with a support team on this already, and since the error seems isolated to one environment, and we haven't received any other reports of this error, it appears this isn't an issue with the SDK, but rather one with your environment.

As such, we're going to close the issue and suggest continuing to work with our support team directly do find a resolution.