question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stripe API call is breaking all local setups

See original GitHub issue

Describe your problem and - if possible - how to reproduce it

When following the instructions in the contributors guide there seems to be an unaccounted for issue. With a fresh build, if you attempt to execute npm run develop you’ll be presented with an error. To resolve the error you have to add a valid Strip public and private key to the .env file before executing npm run build. I’m not sure if the CONTRIBUTING.md should just be updated or if freeCodeCamp/server/boot/donate.js could be updated to prevent this issue.

Here is the error:

/home/charles/development/freeCodeCamp/server/boot/donate.js:62 throw err; ^ Error: Invalid API Key provided: sk_from_*****_*****oard at Constructor._Error (/home/charles/development/freeCodeCamp/node_modules/stripe/lib/Error.js:12:17) at Constructor (/home/charles/development/freeCodeCamp/node_modules/stripe/lib/utils.js:133:13) at new Constructor (/home/charles/development/freeCodeCamp/node_modules/stripe/lib/utils.js:133:13) at IncomingMessage.<anonymous> (/home/charles/development/freeCodeCamp/node_modules/stripe/lib/StripeResource.js:164:21) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1056:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickDomainCallback (internal/process/next_tick.js:218:9) [08:19:31] [nodemon] app crashed - waiting for file changes before starting...

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Flarpcommented, Jun 11, 2018

I believe this is related, as running npm run develop even when not testing Stripe, causes the program to raise the error

Error: Plan already exists.
    at Constructor._Error (/root/freeCodeCamp/node_modules/stripe/lib/Error.js:12:17)                                                                 
    at Constructor (/root/freeCodeCamp/node_modules/stripe/lib/utils.js:133:13)                                                                       
    at new Constructor (/root/freeCodeCamp/node_modules/stripe/lib/utils.js:133:13)                                                                   
    at Function.StripeError.generate (/root/freeCodeCamp/node_modules/stripe/lib/Error.js:57:12)                                                      
    at IncomingMessage.<anonymous> (/root/freeCodeCamp/node_modules/stripe/lib/StripeResource.js:170:39)                                              
    at emitNone (events.js:120:20)
    at IncomingMessage.emit (events.js:218:7)
    at endReadableNT (_stream_readable.js:1054:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Any help? I see no reason there should be a Stripe API call when starting up the server.

1reaction
rachelsinclaircommented, Jun 9, 2018

If you don’t want to go to the trouble of creating your own Stripe account, I found the following test keys in the Stripe documentation:

STRIPE_PUBLIC=pk_test_g6do5S237ekq10r65BnxO6S0 STRIPE_SECRET=sk_test_BQokikJOvBiI2HlWgH4olfQ2

Drop these into .env and you’re good to go!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle errors | Stripe Documentation
Stripe offers many kinds of errors. They can reflect external events, like declined payments and network interruptions, or code problems, like invalid API...
Read more >
Stripe API reference – PHP
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries....
Read more >
Stripe API reference – Errors – curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries....
Read more >
API upgrades | Stripe Documentation
Listed below are all the breaking changes to the Stripe API. Each date corresponds with a new version of the Stripe API. If...
Read more >
Rate limits | Stripe Documentation
The Stripe API locks objects on some operations so that concurrent workloads don't interfere and produce an inconsistent result. The error above is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found