Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Stripe error with webhooks #224

Closed
TommyDong1998 opened this issue Jul 23, 2023 · 4 comments
Closed

Stripe error with webhooks #224

TommyDong1998 opened this issue Jul 23, 2023 · 4 comments

Comments

@TommyDong1998
Copy link

TommyDong1998 commented Jul 23, 2023

Previously the webhooks were working but I noticed this week that the webhooks are all giving 500 errors. I deleted an product from stripe console and also added one. They all give the same error:

[POST]
/api/webhooks


No storage option exists to persist the session, which may result in unexpected behavior when using auth.
If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.

  • error TypeError: Cannot read properties of undefined (reading 'headers')
    at /var/task/.next/server/chunks/501.js:3897:61
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@TommyDong1998 TommyDong1998 changed the title Stripe webhooks stopped working Stripe error with webhooks Jul 23, 2023
@TommyDong1998
Copy link
Author

Update: Found out that the env variable STRIPE_WEBHOOK_SECRET_LIVE is now STRIPE_WEBHOOK_SECRET 😅

The error came from
if (!sig || !webhookSecret) return;

Lets change that to

 if (!sig || !webhookSecret) {
      return new Response(`Missing signature or webhook secret`, {
        status: 500
      });
    }

so that it is more understandable

@espinozahector
Copy link

@TommyDong1998 Were you able to get this resolved? I validated the .env variable and I still receive a 500 error.
I believe it is more of an issue with the stripe signature

@kevinkatzke
Copy link

@espinozahector Renaming the environment variable STRIPE_WEBHOOK_SECRET_LIVE to STRIPE_WEBHOOK_SECRET in the Vercel settings of your project fixes the error. Don't forget to redeploy the latest deployment from the Vercel Dashboard for these changes to take effect.

@leerob
Copy link
Member

leerob commented Feb 12, 2024

#278

@leerob leerob closed this as completed Feb 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.