WaspW
Wasp16mo ago
neogeofun

Error Report from Stripe.ts and Relevant Questions

Posting enough to show error for privacy reasons:

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client.

at stripeWebhook (/path/app/src/server/webhooks/stripe.ts:253:26)
[ Server!]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!]     at <anonymous> (/path/app/.wasp/out/sdk/wasp/server/utils.ts:26:5)

And this is line 253 from Stripe.ts:
response.status(400).send(`Webhook Error: ${err?.message}`);

When I log the error right before (it is inside a catch block), it is the same as 'Cannot set headers after they are sent to the client.'

Couple other notes, I did some changes to webhook but I am not sending any extra responses, just capturing extra events to do some updates and record customer payments:

else if (event.type === 'charge.succeeded')


The work goes through successfully (payment is recorded in the db) and nothing is functionally affected by this error but figure this should still be considered.
Was this page helpful?