#tacologist.
1 messages · Page 1 of 1 (latest)
I was just able to trigger this event successfully with stripe trigger invoice.payment_failed
Is that the command that you are running or is it something else?
Same one, and I get the event on the backend
Oh so the error is from a request that your backend makes after receiving the event?
Yes, sorry I should've specified
The event that comes with triggering that command, may be missing something?
I am not sure how that works
Can you send me the request ID for a time that you got that error? req_123
req_d8j8i3FO4DHqtG
I am not sure what you mean by this. Can you talk a little more about what you don't understand here? That command should trigger the event and send it to the endpoint that your other CLI session is listening to
I guess what I don't understand is where should I be passing a string for subscription, which is what the error says
That request looks to be a different one. The response is about a decline, it does not seem to say that a subscription ID is required https://dashboard.stripe.com/test/logs/req_d8j8i3FO4DHqtG
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Wouldn't payment failed be triggered by a card declined?
I ran it again, and getting the same response. Here is part of the log:
"request":{"id":"req_XKUMSvzdRU0Jog","idempotency_key":"189cb224-371a-41a1-9c96-4424c2a99cfc"},"type":"invoice.payment_failed"},"queue":"stripe","errorMessage":"You passed an empty string for 'subscription'. We assume empty values are an attempt to unset a parameter; however 'subscription' cannot be unset. You should remove 'subscription' from your request or supply a non-empty value.","errorStack":"Error: You passed an empty string for 'subscription'. We assume empty values are an attempt to unset a parameter; however 'subscription' cannot be unset. You should remove 'subscription' from your request or supply a non-empty value.\n
Interesting. That is not the error that I see in our logs at all. Looking further in to this
And does that error just show up in the CLI when you run the stripe trigger command?
That shows in the logs of my local backend
The cli where I trigger the event doesn't show any errors
Can you send me the code of the API call that your backend is making when it gets this error? I am not seeing that error in your logs either.
To be clear, I am sure it is happening, just having trouble finding it the way that I normally do
stripe trigger invoice.payment_failed A newer version of the Stripe CLI is available, please update to: v1.19.2 Setting up fixture for: customer Running fixture for: customer Setting up fixture for: payment_method Running fixture for: payment_method Setting up fixture for: invoiceitem Running fixture for: invoiceitem Setting up fixture for: invoice Running fixture for: invoice Setting up fixture for: invoice_pay Running fixture for: invoice_pay Trigger succeeded! Check dashboard for event details.
YEah you bet one sec let me send you the code
Ah okay I just saw where exactly this is happening. In the code, I am getting the subscription from the invoice by casting invoice.subscription as string and in the invoice I get from triggering this, subscription is null. This is the function:
const lastPaidInvoice = await this.stripeService.findLatestInvoiceByStatus( invoice.subscription as string, 'paid', )
And I logged the invoice, and see that subscription is null
Ah here we go, I found some examples of this https://dashboard.stripe.com/test/logs/req_MNtnOpUaXuDan0
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
So the issue looks to be that your integration is sending subscription: "" when trying to retrieve a list of invoices. That parameter is a filter so that you can find all invoices that are related to a specific subscription. So the fix would be to either pass a subscription ID or to omit that parameter
The invoice comes from the event, no?
This is how I am working with the webhook:
const invoice = event.data.object```
Right, this error isn't from the event per se. This error will occur any time you try to retrieve a list of invoices and supply an empty string for the subscription filter
Ah, so my guess is that your code is trying to get the ID of the subscription that is related to this invoice, but the invoice created by the trigger command is a one-off invoice, so your code is just grabbing null or an empty string and trying to filter on that