#ahjaydog-email
1 messages · Page 1 of 1 (latest)
Hello! What email is this? Is this code you've written to send an email? Or is this a Stripe email?
line 6
whenever I put that code anywhere else (not in a webhook) it works
It severely seems delayed.
I'm not familiar with this EmailMessage function - what is this from?
what is strange too is i don't even get errors if i do anything wrong in that EmailMessage linee
You're not getting any errors or exceptions at all?
Like if I remove the [ ] I should get an error but i don't
Nope
@csrf_exempt -> does this have anything to do with it?
the webhook itself succeeds though
the invoice and subs get deleted though
have you confirmed your code is even reaching that line? Like if you put print statements before and after the send email code are they being hit?
i'll try again
It did not.. i'll try putting it before the try block
ok that worked right away.
However... I don't want to send an email after network retries
just once
that is why i put it in the try block to make sure there was a sub first
Do you mind sharing one of the subscription or invoice IDs that you're testing this out with?
yea one sec i'll make a fresh test
in_1LFMYFIeTJrsS1reX6XCFPqJ
sub_1LFMYFIeTJrsS1rejOaQo6zs
The try block runs that is what I printed for invoice and sub
from inside the try block
unless... could it be because I am cancelling and it runs another webhook I have for cancel event?
Actually it runs the cancel one before that
I think the issue here is that you have other code somewhere in your integration that's deleting the subscription BEFORE you get to the 'stripe.Subscription.delete(subscription_id)' line in your webhook code. As a result, that line fails and bypasses the next line that send the email
[27/Jun/2022 18:22:06] "POST /webhooks/stripe_failed_webhook/ HTTP/1.1" 200 0
subscription deleted
[27/Jun/2022 18:22:07] "POST /webhooks/stripe_cancel_webhook/ HTTP/1.1" 200 0
test
in_1LFMYFIeTJrsS1reX6XCFPqJ
sub_1LFMYFIeTJrsS1rejOaQo6zs
[27/Jun/2022 18:22:09] "POST /webhooks/stripe_payment_webhook/ HTTP/1.1" 200 0
In this request (https://dashboard.stripe.com/test/logs/req_3Krd6Dnu8piBnM) - you can see this deletion request actually failed, because it had already been deleted in this request (https://dashboard.stripe.com/test/logs/req_qEVge9m2tWFkW3) a couple seconds earlier
👍 hopefully that helps narrow it down!
yea i think it does