#! rendives.nl
1 messages · Page 1 of 1 (latest)
Hi there
Hey!
I researched it and it is because you have to have an export default, where should i put it here? Because the docs don't mention it
Well each Component in a React app needs an export
So you would basically just put this at the bottom
I'm not that familiar with Next.JS specifically though
Do you mean without anything behind it (just blank export default)? Because it needs an expression right.
Thats not possible i think, that gives the error Expression expected
if i put export default in front of the app.post i get a response error InternalServerError: stream is not readable i didn't get this without it
Like I said, I don't really know much about Next.JS. But a quick google search yields: https://stackoverflow.com/questions/65058408/nextjs-import-export-modules-in-one-line
Overall this isn't really a Stripe issue and not something I can really help you with
okey thanks! I solved this problem at least. I'm going to continue debugging. Thanks for your help
Sure thing
i got it to work
Nice!
its kinda weird, so the first one succeeds with 200, but then i get the error and it fails error - uncaughtException: Error: listen EADDRINUSE: address already in use :::3000 no idea why
That seems like your server is trying to boot multiple times at that route
sudo lsof -i tcp:3000 logs this when it fails:
firefox 350 maurijnvd 526u IPv4 0xc2ef5ab6950b06af 0t0 TCP localhost:60365->localhost:hbci (ESTABLISHED)
node 65890 maurijnvd 23u IPv6 0xc2ef5ab68e71a317 0t0 TCP *:hbci (LISTEN)
node 65890 maurijnvd 42u IPv6 0xc2ef5ab68e719797 0t0 TCP localhost:hbci->localhost:60365 (ESTABLISHED)
but when it succeeds it logs the same
When you say "it fails" what do you mean exactly
Like you are trying to send an Event to your endpoint and then seeing that error?
500 error and this error
just this:
export default app.post(
"/api/stripe-webhook",
bodyParser.raw({ type: "application/json" }),
(request, response) => {
const payload = request.body;
console.log("Got payload: " + payload);
response.status(200).end();
}
);
So you receive the first Event successfully