vercel / nextjs-subscription-payments

Clone, deploy, and fully customize a SaaS subscription application with Next.js.
https://subscription-payments.vercel.app/
MIT License
5.83k stars 1.19k forks source link

Stripe error with webhooks #224

Closed TommyDong1998 closed 5 months ago

TommyDong1998 commented 11 months ago

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.

TommyDong1998 commented 11 months ago

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 commented 11 months ago

@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 commented 9 months ago

@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 commented 5 months ago

https://github.com/vercel/nextjs-subscription-payments/pull/278