#tacologist.

1 messages · Page 1 of 1 (latest)

tepid acornBOT
fathom elbow
#

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?

runic basin
#

Same one, and I get the event on the backend

fathom elbow
#

Oh so the error is from a request that your backend makes after receiving the event?

runic basin
#

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

fathom elbow
#

Can you send me the request ID for a time that you got that error? req_123

runic basin
#

req_d8j8i3FO4DHqtG

fathom elbow
runic basin
#

I guess what I don't understand is where should I be passing a string for subscription, which is what the error says

fathom elbow
runic basin
#

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

fathom elbow
#

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?

runic basin
#

That shows in the logs of my local backend

#

The cli where I trigger the event doesn't show any errors

fathom elbow
#

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

runic basin
#

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

fathom elbow
#

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

runic basin
#

The invoice comes from the event, no?

#

This is how I am working with the webhook:

    const invoice = event.data.object```
fathom elbow
#

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

runic basin
#

Ahh okay

#

I will just manually override whatever data I need to test then