#davide-webhook-cli
1 messages · Page 1 of 1 (latest)
Hello! Are you testing this locally (with the CLI)?
@topaz viper Just making sure you see my question
While you were testing locally I assume you were testing with the CLI? and it's not failing after you've deployed it to production?
hello @last rover thank you for your help. no I am testing it in a production enviroment on Railway.
I tested the same code locally with the stripe CLI and it worked fine. It raises the error only in production. I
and how have you confirmed that the endpoint secret is correct - have you logged it and compared it to the secret from the dashboard?
Yes. I took it from the webhook dashboard in test mode and copied as an enviroment variable in Railway, same as the other enviroment variables.
I printed the logs to check it in previous versions and it was ok
And you're sure you copied your test mode one and not your live mode one? I see that you have the same webhook endpoint in both test and live
correct, the test mode one.
hello @nova seal ! can you help me on this?
I can, give me some time to catch up, Discord was quite busy for the past hour
davide-webhook-cli
payload_bytes = payload.replace(b'\n\n', b'\n')``` the fact that you do this is quite surprising to me, You shouldn't be touching the raw body/data at all to avoid any issue with signature verification
Overall, you need to write your code in a way that never touches the raw body at all and uses exactly what we send you
I also tried without that line but the result is always the same unfortunately. The payload looks correct as a b string ma in any way I tried, I never got it working on production. However, it works well in a local test
Unfortunately this can be really hard to debug because a lot of things in your system can tamper with the raw data.
My advice is to basically have 2 separate endpoints, one on your production system, one of your local environment so that the same Event can be sent to both. Then log the raw body and compare them