braintree / braintree_node

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

Error: Missing publicKey #151

Closed ProductOfAmerica closed 5 years ago

ProductOfAmerica commented 5 years ago

General information

Issue description

I'm getting the following error when trying to start my server:

Error: Missing publicKey
    at new Config (/myserver/node_modules/braintree/lib/braintree/config.js:31:36)
    at Object.connect (/myserver/node_modules/braintree/lib/braintree.js:38:46)
    at file:///myserver/routes/utils/braintreeUtils.mjs:3:34
    at ModuleJob.run (internal/modules/esm/module_job.js:96:12)

Here's my code under /routes/utils/braintreeUtils.mjs:

import braintree from "braintree";

export const gateway = braintree.connect({
  environment: braintree.Environment.Sandbox,
  merchantId: process.env.BRAINTREE_ID,
  publicKey: process.env.BRAINTREE_PUB,
  privateKey: process.env.BRAINTREE_PRIV
});

I have all my environment variables set, so I'm not sure why I'm getting this error. Anything helps, thanks!

crookedneighbor commented 5 years ago

Please contact our support team: https://help.braintreepayments.com/

They'll be better equipped to walk through issues with your integration. It's unlikely that this is an issue with the SDK itself.