#cent
1 messages · Page 1 of 1 (latest)
Hi 👋 can you elaborate?
but my endpoint is not doing redirect
Hm, it looks like your endpoint is sending that 308 status code back to us, we won't have much insight into why it is doing that.
Can you share the ID of an Event where you saw this behavior?
evt_1Mmak4EnD23RzUmzxgUb21ID
The tool you were using to check for redirects does show that the endpoint where you're directing Events is responding with a 308:
https://www.whatsmydns.net/redirect-checker?q=https%3A%2F%2Fjoulukaunistused.ee%2Fapi%2Fwebhook
but how do I fix this?
We won't know that, it depends on how your endpoint is built and which part of your stack is causing your endpoint to respond with a redirect. Since you own and maintain that endpoint, you'll be best suited to debug and troubleshoot it.
now I got different error when I added "/" to then end of my endpoint
but now I'm getting 400
Webhook Error: Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the raw request body.Payload was provided as a parsed JavaScript object instead.
Signature verification is impossible without access to the original signed material.
Learn more about webhook signing and explore webhook integration examples for various frameworks at https://github.com/stripe/stripe-node#webhook-signing
here's my setup
Based on the error, it sounds like your endpoint is parsing the request we send to JSON rather than working with the raw request body as a string or a buffer. You'll need to identify the part of your flow that is doing that parsing and adjust/remove it.
I don't know, I'm not seeing anything in the code that you share that looks like it would do that, so I suspect it is happening somewhere else.
What web framework are you using?
the event is been triggered by customers action in the billing portal
next js
Ah, I don't know Next, so the next part is going to be some guessing. Are you using API Routes?
maybe I should try req.rawBody ??
Looks like the API Routes in Next have the bodyparser enabled by default:
https://nextjs.org/docs/api-routes/request-helpers#:~:text=bodyParser is automatically enabled. If you want to consume the body as a Stream or with raw-body%2C you can set this to false.
It looks like that may need to be disabled, or some other approach would need to be used to get the raw request body.
It's still throwing the error?
The request includes JSON data as a string, it will look like JSON even if it hasn't been parsed into a JSON object.
but I'm still getting the error on stripe
You mean the constructEvent function that is being executed is still saying it's receiving a parsed object?
this helped
thanks
Awesome, glad to hear you were able to get to the bottom of it!