#josephmalam - webhooks
1 messages · Page 1 of 1 (latest)
Hi @sullen abyss !
reviewing the above - just a min
Hmm that's curious -- if you're getting invoice.paid for a subscription, the subscription should already exist
Can you share an example failing request ID?
Sure - evt_1Kpr01LmG1DihkghhrPFAFDy
It's especially strange because those two failing events occurred after customer.subscription.created succeeded. And when I manually try retriggering the event it still fails, even though the subscription should exist
I mean the api request you say hits an error when you fetch the subscription, eg
Sorry, I'm not sure what you mean?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You said:
The last two are failing, seemingly because I'm trying to retrieve the subscription. My error logs say:
ReferenceError: Cannot access 'subscription' before initialization
What is an example request when that happens?
You can also find request identifiers in the URLs of individual request logs in your Dashboard.
I'm not sure where I'm looking for that, is it different toevt_1Kpr01LmG1DihkghhrPFAFDy?
looking (I'm stepping in)
I'm guessing you see ReferenceError: Cannot access 'subscription' before initialization in your code at runtime, right?
Yep
have you instantiated the stripe() object from stripe-node in that webhook handler?
Do you mean this?
const stripe = require('stripe')('[key]');
I have all my hooks in a switch statement:
switch(event.type) {
...
and I printed the invoice.subscription just to confirm it does include it, which it does: sub_1KpqzxLmG1DihkghZKDLt0Ia, and I've checked Dashboard and that subscription does exist
can you log out that stripe is instantiated at that point? I know you mentioned it is but just a gut check
Is there something I should look for in particular here?
deleted cause of secret key^ (eventhough test mode)
no so that looks fine ... thinking
I think I've solved it and if I have it was a silly mistake on my part... now I have a separate issue, give me a few mins to test and I'll let you know