Stripe Webhook not firing when relevant events fire
I am trying to use the standard OpenSaaS implementation and have noticed that the stripe webhook does not fire at all even when the events are happening (I am testing it locally) - I've tried both just having it running and manually triggering the events and manually firing the events via the command line, but the stripe webhook doesn't run at all. I've added my STRIPE_WEBHOOK_SECRET to my env variables.
18 Replies
Hi @CamBlackwood. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It seems like you've done most of the necessary steps to set up the Stripe webhook. However, there are a few things you could check:
1. Stripe CLI: Make sure you have the Stripe CLI running when testing. You can follow the guide here (https://docs.opensaas.sh/guides/stripe-testing/).
2. Webhook Events: Ensure that your webhook is listening for the correct events. You can test if your webhook is listening for a specific event by running the following command in another terminal window:
Replace
<event-name>
with the name of the event you want to test, such as invoice.paid
.
3. Webhook Endpoint: In your Stripe Dashboard, you can set the webhook endpoint to your server domain. It should look something like {your-fly-server-domain}/stripe-webhook
.
4. Webhook Secret: When you deploy to a server like Fly.io, you need to change the webhook secret in the Stripe -> Dev -> Webhooks section. Create a new webhook by URL pointing to your server url/stripe-webhook endpoint, and then add the Webhook Secret found on the stripe dashboard to your .env settings.
If you're still having issues, it might be helpful to check the OpenSaaS documentation (https://docs.opensaas.sh/guides/deploying/#setting-up-your-stripe-webhook) or ask for help in the Wasp Discord community (https://discord.com/channels/686873244791210014/1220115828012351529).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @CamBlackwood, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@Vinny (@Wasp) one more thing π
@miho sorry about all my questions in the last 24 hours π
I discovered a few issues simulateneously that have been a bit tricky, this one is weird as I can see the events firing off, yet the webhook itself doesn't fire locally, and I haven't changed the webhook at all from the standard implementation
weird
did you create a new Stripe account/store? If so, you need to run
stripe login
again and log in with that new account. That will give you a new signing secret after you then run the webhook listener locally.
also, another thing to check is the returned error message in the stripe dashboard
last thing, we had someone testing a $0 product and that's a weird edge case where everything seems to succeed but some webhook events never fire. don't do this πNo worries, just fire away π we are here to help and learn a lot from your questions!
I'm fully logged in and can access the stripe cli, I should say that actually the webhook is firing, but the webhook listener function is not firing src/server/webhooks/stripe.ts - this one - it is defined in the main.wasp like this -
I can see the correct events firing in there terminal where I ran stripe listen --forward-to localhost:3001/payments-webhook, but the api endpoint in the actual wasp app does not fire
oh, should also say I have STRIPE_WEBHOOK_SECRET set up
you're on an old version of Open SaaS
you need to change the forward-to address
stripe listen --forward-to localhost:3001/stripe-webhook
not payments-webhook
ahhhh
that makes a lot of sense
I put a warning about it here but maybe it needs to be lower? https://docs.opensaas.sh/guides/payments-integration/#install-the-stripe-cli
OpenSaaS.sh
Payments Integration
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
I actually think maybe a different background colour would be best, I am colourblind so to be honest I would've struggled to spot the contrast there
either way silly mistake from me, I thought it was a stripe endpoint of some kind rather than a wasp one π€¦ββοΈ
hmm ok yeah then red/warning would be better than note
your solution instantly worked btw, thanks Vinny
yeah anything high contrast from the background is v useful for people with my type of colourblindness. Although I should've read it - maybe it's worth putting the sentence "make sure to use the url that matches the webhook url in your main.wasp file payemnts API definition." in bold?
good idea
if you want I can make a version of it and raise a PR?
no need. i was actually just working on updating the docs https://github.com/wasp-lang/open-saas/pull/273
GitHub
Fix docs links & other small updates by vincanger Β· Pull Request #2...
A user in discord notified us of some dead links, so I went through and actually found many and updated them. Along with that, I made some small updates that I overlooked with the recent Lemon Sque...
hey thanks vinny also had this issue!
https://docs.opensaas.sh/guides/payments-integration/#testing-webhooks-via-the-stripe-cli
the docs have not been updated here - still wants to send it to /payments-webhook @Vinny (@Wasp)
OpenSaaS.sh
Payments Integration
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
lucky i found this thread! thanks guys
oh i see im on the old one.. well it caught me out i guess make it a little more noticeable to help other people