Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Notifications
Mark all as read
Q&A
Parent

How to circumvent Stripe::AuthenticationError: No API key provided Question

+2
−0

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.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+1
−0

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 app/assets/javascripts/donations.js is being loaded and comment that out? This appears to be the entry point for calling all the Stripe stuff, so if it never gets loaded, maybe nothing ever gets checked.

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:

<%= javascript_include_tag "https://js.stripe.com/v3/" %>

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.

Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

Might work (2 comments)

Comments on How to circumvent Stripe::AuthenticationError: No API key provided

Might work
Trilarion‭ wrote 7 months ago:

An ERB file is something like a template (i.e. HTML with special placeholders that are filled with content of variables at runtime and give (render) a web page that is served, so mostly responsible for layout).

I can also try other stuff, even try to fix the problem or get a Stripe API key and provide it somehow. Or I could even go back to a commit that was before donations were implemented and then try to work with that for the moment.

Monica Cellio‭ wrote 7 months ago:

My first thought was to go back in time to before that commit, but it looks like you would miss some other stuff, including at least one PR from you if I recall correctly. Whether it's stuff that's relevant for the immediate task you're working on, I don't know. But it made me wonder if a more targeted fix were possible. I'm sorry for the hassle!

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us! Donate