Forum Academy Marketplace Showcase Pricing Features

<Solved> Stripe error - Test webhook error: 400 (No such event: event_id)

Hi there fellow bubblers,

I am in the process of setting up Stripe webhook for my app, and I have been facing an issue that I need your help with.

My business model is subscription-based, so I need to be informed when invoice payments fail, subscribers’ subscription status changes to ‘past_due’, ‘unpaid’ etc., and therefore I am trying to set up webhook.

I went through Bubble’s and Stripe’s documentation to understand how it was required to be configured, alongside applying learnings from other Stripe integration related questions asked here in the forum earlier, and followed the steps accordingly.

Now the issue I am facing is that when I send the test webhook from within Stripe I get the following error: “Test webhook error: 400”.
The actual response is as follows: “{“statusCode”:400,“message”:"Stripe error No such event: evt_00000000000000”}”.

My understanding is that had it been the case of condition not being met then Bubble still would have passed 200 response, because I have that setting check-marked (indicated in the screen shot below). Has anyone here faced the same issue earlier or if you know what might be causing this error?

For your reference, I have attached the screenshot of an example API workflow that I am testing the webhook with - it’s identical to what @emmanuel shared in one of the older posts (API Endpoint - Use Stripe Webhooks)

Also, while going through the Bubble documentation I noted that the new API version was introduced recently, and so I am using 1.1 in the URL. My URL looks like this: https://appname.bubbleapps.io/version-test/api/1.1/wf/endpoint_name

Any help will be very much appreciated.

it’s because when your endpoint is triggered, you run an API call looking for the evt_00000000000000, which does not exist. So stripe returns an error.
It’s actually a good news, this error indicates you’ve well set your endpoint :slight_smile:

Thank you for taking the time to go through the description and responding, @nicolas.daprigny. Really appreciate that. I am very relieved to hear this :slight_smile:

I’ll set up the payment functions in my app, and let you know how I go with the tests then.

Cheers for your help.

Hi @nicolas.daprigny,

Hope you have been well.

Unfortunately I haven’t had any success in testing the webhook. I wanted to reach out to you to ask for your help in case you have experienced this earlier or if you know what might be causing this.

I am testing an endpoint (in test version) that is supposed to be triggered whenever a charge is failed. What I did was tried the steps suggested by Stripe to test this scenario. It’s as per the screen shot attached below. Also tried the steps from within my app, just in case, to have the payment declined. To give you a quick overview, what I did was entered the card number (provided by Stripe) that gets declined, and therefore results into the actual charge.failed event getting created in Stripe’s Test mode.

In Stripe, I do see the events - charge.failed, invoice.updated, and invoice.failed - getting created after the invoice payment is failed, but unfortunately the API Workflow doesn’t seem to be getting triggered because it neither creates a new eventNotified record nor does it send out the email. Plus, for the purpose of testing I have defined an additional step, to update the value of a field in user record to ‘testpassed’.

I have tried tracing back the logic of the API Workflow a few times, and it looks all right, logically. I expect it to work, but I think I might be doing something wrong somewhere. Not really able to spot what that is though.

Is this something you are familiar with? Alternatively, from your experience, is there something that you might advise me to double-check?

For your reference, I have attached some screenshots below:

Hi,
I guess the issue may come from the endpoint condition. Can you tell me what the “do a search for Users: first” stands for and why you do this search ?
Can you try the endpoint removing this condition ?
Best,

I agree. That’s a good idea to simplify the testing for now - regarding removing the condition ‘Search for Users:first item is not empty’. Essentially, I was using it only as a measure to double check that there is at least one user in the system that the event_id (sent by Stripe) pertains to. What I was doing here was querying the event_id and fetching the stripe_customer_id associated with it. Then using the stripe_customer_id, I was fetching the email associated with the customer, and then using that customer email (from Stripe), I was querying the user table in my app to ensure that there was a user that the email matched with. In hindsight, I think I can do without this condition even when webhook starts working all right.

Now, I tried testing the webhook by making a couple different changes, one change at a time.

Test 1: I removed the condition ‘Search for Users:first item is not empty’ and then tried testing the webhook. I tried testing it from within the Stripe (by initiating an invoice payment and causing it to fail) as well as from within my app.

Unfortunately, still no luck. I can see the charge.failed events getting created in Stripe, but the workflow in my app doesn’t appear to be doing anything.

The workflow looks like this now:

Test 2: I thought of trying to test without having any condition as such because then it would just mean that the workflow accepts the event_id from Stripe and creates a new record in the event notification table, alongside updating the user record and sending out a notification email to the concerned user.

So, I removed ‘Stripe Event Notified’s:count is 0’ condition as well. I was using it only to ensure that one event is actioned on only once, and therefore preventing the possibility of sending multiple emails to customer for one event. Tried testing (both from within the Stripe as well as from my app), but without any luck yet.

I was also thinking about the possibility of endpoint not being set-up properly, and so double-checked the configuration. Everything looks all right there. Plus, given the result of ‘Send test webhook’ function (per my first post in this thread, which you were very kind to help me with) the communication between Stripe and the endpoint does appear to be established.

Hey @nicolas.daprigny,

Mate, I am very pleased to confirm that I finally figured out what the issue was. It was attributed to my mistake in setting up endpoints :slight_smile:

Here is the mistake that I had made: while setting up a new endpoint, I had mistakenly selected ‘Connect’ as the option; instead of ‘Account’. I don’t know what I was thinking while setting it up because under ‘Connect’ tab (the separate dedicated tab next to ‘Webhooks’, in Account settings) I could clearly see Stripe telling me that I didn’t have any connected applications. As soon as I created the endpoint selecting ‘Account’ as the option, webhooks started working like a charm. In hindsight, it was a good mistake to make because it made me learn so much more.

Thank you so much for your help over past couple days. You are very kind.

Cheers, and have a good one.

You re welcome.
I don t think the check by User us necesary, but it s not the real issue here anyway.

Can you copy paste a screenshot of your webhooks settings in Stripe please ? Here or in a private message ?

Yeah, completely agree. After going through your message earlier today, when I was reviewing the condition I also realised that I could have done without the user validation criteria in there. After the issue was resolved, I revised the API workflows, and have now gotten rid of that user validation criteria. Thankfully it’s working all good now.

Here is the screenshot of webhook setting in Stripe. This one is for charge.failed event specifically.

1 Like