How to circumvent Stripe::AuthenticationError: No API key provided Question
I want to setup a local QPixel instance (WSL - Ubuntu 20.04) and am following the guide by luap42.
Finally I get an error
Stripe::AuthenticationError: No API key provided. Set your API key using "Stripe.api_key = <API-KEY>". in DonationsControllerTest.
DonationsControllerTest#test_should_create_PaymentIntent: Stripe::AuthenticationError: No API key provided. Set your API key using "Stripe.api_key = <API-KEY>". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email [email protected] if you have any questions. app/controllers/donations_controller.rb:33:in `intent' test/controllers/donations_controller_test.rb:12:in `block in <class:DonationsControllerTest>' bin/rails test test/controllers/donations_controller_test.rb:11
This is probably related to the donation box and specific for Codidact, not really needed for QPixel. While it's nice that QPixel can have a donation possibility via Stripe, for my local development I would rather keep it optional, i.e. I would prefer if QPixel can be configured to work without donations.
Is there a quick fix to work around that error (without needing to get an API key from Stripe)?
I also filed a feature request to make donations optional. This here is more like the bug report and for quick fixes.
I don't know the correct way to do this, but I was looking at the commit that added donations, and I wonder, as a workaround until you get the correct answer (presumably from Art), it would work to comment out a couple things.
Specifically, can you find the place in the project where
If that's not enough, I also see this in
app/views/layouts/_head.html.erb, and I wonder what happens if it's not there:
I'm obviously just guessing (and I don't even know exactly what an ERB file is); my goal is to get you unblocked until we get the real answer. Maybe my guesses are all wrong but you, looking at that commit, can see what needs to be done.
1 comment thread
Stripe setup is handled in
config/initializers/stripe.rb, where the Stripe API key is set based on the values saved in the Rails credentials file.
You should be able to run
rails credentials:edit (set the EDITOR environment variable to whatever command line editor you use first), and set
stripe_test_secret to any non-empty string, and that should work as long as you're not actually running any Stripe related operations.
0 comment threads