#Soffry - python webhook

1 messages · Page 1 of 1 (latest)

stable dragon
#

Hello. One moment while I look this over

#

Your question is why isn't your logger working? Just want to clarify

cursive cape
#

Yes, it works fine with other functions; in this function however, it seems to skip everything after event = stripe.Webhook.construct_event(payload, sig_header, endpoint_secret), except just before returning the 200 status response

#

I don't know if it's an issue with the logger, or that function

#

Just to add more detail, the fulfill_order function should simply log a message, but it's never logged.

stable dragon
#

Try catching the generic Exception around that construct event and do a logger. See if it's throwing some other exception

cursive cape
#

OK! Be right back

#

Still nothing, the webhook function returns the status 200 response

stable dragon
#

And to confirm, what are the logs that are printed out?

#

Can you paste the output from terminal?

cursive cape
#
main.views INFO 2022-04-13 15:52:04,627 views 381808 140071030191872 Webhook attivato!
main.views INFO 2022-04-13 15:52:04,627 views 381808 140071030191872 SIG_HEADER: t=1649857924,v1=1eed...
main.views INFO 2022-04-13 15:52:04,627 views 381808 140071030191872 Provo a creare l'evento!
main.views INFO 2022-04-13 15:52:04,630 views 381808 140071030191872 Webhook in uscita!
main.views INFO 2022-04-13 15:52:09,407 views 381809 140071080548096 Webhook attivato!
main.views INFO 2022-04-13 15:52:09,407 views 381809 140071080548096 SIG_HEADER: t=1649857929,v1=7a21...
main.views INFO 2022-04-13 15:52:09,407 views 381809 140071080548096 Provo a creare l'evento!
main.views INFO 2022-04-13 15:52:09,410 views 381809 140071080548096 Webhook in uscita!
main.views INFO 2022-04-13 15:52:09,554 views 381809 140071072155392 Webhook attivato!
main.views INFO 2022-04-13 15:52:09,555 views 381809 140071072155392 SIG_HEADER: t=1649857929,v1=d62...
main.views INFO 2022-04-13 15:52:09,555 views 381809 140071072155392 Provo a creare l'evento!
main.views INFO 2022-04-13 15:52:09,558 views 381809 140071072155392 Webhook in uscita!
main.views INFO 2022-04-13 15:52:09,669 views 381808 140071013406464 Webhook attivato!
main.views INFO 2022-04-13 15:52:09,670 views 381808 140071013406464 SIG_HEADER: t=1649857929,v1=281f...
main.views INFO 2022-04-13 15:52:09,670 views 381808 140071013406464 Provo a creare l'evento!
main.views INFO 2022-04-13 15:52:09,673 views 381808 140071013406464 Webhook in uscita!
main.views INFO 2022-04-13 15:52:10,356 views 381809 140071046977280 Webhook attivato!
main.views INFO 2022-04-13 15:52:10,356 views 381809 140071046977280 SIG_HEADER: t=1649857929,v1=3ad18093...
main.views INFO 2022-04-13 15:52:10,356 views 381809 140071046977280 Provo a creare l'evento!
main.views INFO 2022-04-13 15:52:10,359 views 381809 140071046977280 Webhook in uscita!

Where "Webhook attivato" = "Webhook activated"
The signatures get printed (I chopped them for discord char limit)

#

"Provo a creare l'evento!" = "Trying to create the event!"

#

"Webhook in uscita" is printed just before the return

#

I used a "checkout.session.completed" event to test it from the VS Code Stripe extension

#

The same situation occurs if I manually do the purchase from the website

stable dragon
#

How are you running/deploying this code?

cursive cape
#

It's a Django website running on an AWS Lightsail

stable dragon
#

I suspect you haven't deployed the latest version of the code then

#

Or haven't deployed correctly

cursive cape
#

Thanks for the suggestion, I will check the code and do more tests.

stable dragon
#

I recommend running locally

#

Saving the file and running this exact code locally