#developer

1 messages · Page 1 of 1 (latest)

hardy elbow
#

Hi 👋 no, you shouldn't use the CLI in a production deployment. Can you tell me more about the error that your server is throwing when we try to send you an event?

ember hull
#

It just returns an html of 500 server error

hardy elbow
#

That usually indicates that the event handling code on your server crashed, have you added any logging to that code to try to determine where the crash is occurring?

Are you verifying the webhook signatures, and if so, did you update the signing secret that your code is using to match the secret of the production webhook endpoint?

ember hull
#

I did change the signing secret. To verify the webhook signature, I do:

#

sig_header = request.META['HTTP_STRIPE_SIGNATURE']
event = None

try:
    event = stripe.Webhook.construct_event(
        payload, sig_header, endpoint_secret
    )
except ValueError as e:
    # Invalid payload
    return HttpResponse(status=400)
except stripe.error.SignatureVerificationError as e:
    # Invalid signature
    return HttpResponse(status=400)
#

(Python)

#

Is that alright?

hardy elbow
#

From what I can see there, that looks right. And it looks like you have the exception cases set up to be caught and return a properly formed response, so I don't think that failing would result in a 500 response.

#

I would recommend looking in your server logs to see if it's already logging any sort of crash or uncaught exception, and if that doesn't yield anything useful then I would start adding log lines to your code so you can see how far it is getting to begin narrowing down where it crashes.

ember hull
#

Sounds good. Thank you.

hardy elbow
#

Any time, happy to help! Sorry, I couldn't be more specific.