vercel / nextjs-subscription-payments

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

Webhook error: "Webhook handler failed. View logs." #165

Closed rannikkopyry closed 1 year ago

rannikkopyry commented 1 year ago

Stirpe webhook gives error 400 with message: Webhook error: "Webhook handler failed. View logs." Stripe's logs doesn't show that anything would be wrong. Api-keys and secrets etc are double-checked. Stripe and supabase setup done according to the README.md of this repository. My other production app using this template with Stripe webhooks also broke in prod.

Anyone have idea why?

thorwebdev commented 1 year ago

Can you check your function log on Vercel?

rannikkopyry commented 1 year ago

My function logs on Vercel just say awaiting new requests, so probably no functions has even been ran there.

andriusmv commented 1 year ago

My function logs on Vercel just say awaiting new requests, so probably no functions has even been ran there. @rannikkopyry

no. Vercel function logs only work in live mode, they are not kept/saved. You should go back to the functions tab, and once you're there go to your website on a different tab and try to log in, check-out any product with price, then head back to your vercel functions tab and then you'll see new messages. Those you can paste here to analyze.

hope this helps. btw did you solve the issue? or u still having trouble?

rannikkopyry commented 1 year ago

Still having trouble... here are the logs Could not find a relationship between 'products' and 'prices' in the schema cache

{ code: '42P01', details: null, hint: null, message: 'relation "public.prices" does not exist' }

{ code: '42P01', details: null, hint: null, message: 'relation "public.products" does not exist' }

Don't know if you can say anything based off those, I'm kind of lost :D

aleskozelsky commented 1 year ago

I have exactly the same error. There is a duplicate thread here with some more info, but still it seems like something is wrong with the starter (webhooks?)

aleskozelsky commented 1 year ago

For me the solutions was that "supabase integration" was pointing to some other supabase project (wrong NEXT_PUBLIC_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY, NEXT_PUBLIC_SUPABASE_URL)

Check those as they may not be updated properly if you have multiple supabase projects going on.

rannikkopyry commented 1 year ago

Thanks I checked the other thread and got a working solution from there. Needed to run the schema.sql in supabase sql editor. Link to the other thread for anyone with the same problem. https://github.com/vercel/nextjs-subscription-payments/issues/168