Comments (7)
@alaq this is likely due to an incorrect webhook secret env var (https://github.com/vercel/nextjs-subscription-payments/blob/main/.env.local.example#L9) Can you double check that you've set that correctly? If you've deployed via the deploy button in the README, then this should have been automatically set.
from nextjs-subscription-payments.
Thank you for your response @thorwebdev!
I re-deployed once more via the deploy button in the README, to have a clean slate. After the completing the wizard I went to check the environment variables on Vercel.
I noticed that STRIPE_WEBHOOK_SECRET
was indicating me to run stripe --listen
(see screenshot below), which I did (./stripe listen --forward-to=localhost:3000/api/webhooks
to be precise) and obtained the secret.
Same thing for the SUPABASE_SERVICE_ROLE_KEY
which I retrieved from Supabase's dashboard.
After that I created my first product but got the same error. I went to the webhook on the Stripe dashboard and noticed that the secret was different, so I copy/pasted the one from the Stripe dashboard and finally re-sent the webhook, which failed again. I also tried re-deploying to see if it would update the secrets, but there was no difference.
It seems to be a me problem here, so there must be something I'm doing wrong?
Before updating these environment variables, I have tried not touching anything and running the webhook, which didn't work either.
I also tried to use the stripe CLI tool to trigger a product.create
event. I receive the webhook, but still get the same error.
This is where stripe-node seems to be tripping: https://github.com/stripe/stripe-node/blob/c85a597f15a225c3b52f90224b4749ad138a9a8c/lib/Webhooks.js#L116
Any help debugging this is appreciated!!
from nextjs-subscription-payments.
Stripe listen is only for local development. You can actually see that the secret was correctly set up for preview and production mode:
To run this locally, you will need to first pull the env vars from vercel: https://github.com/vercel/nextjs-subscription-payments#setting-up-the-env-vars-locally and then set the missing secrets in your .env.local
file.
But your preview and production webhook should be working. What do you see in your Stripe account under https://dashboard.stripe.com/test/webhooks? It should look something like this:
And when you click on your webhook endpoint, you should see
from nextjs-subscription-payments.
I've only been using stripe listen
to try to debug this locally.
Unfortunately it has never worked on the production environment. I have gone through the installation process a few times.
from nextjs-subscription-payments.
I just re-ran everything from scratch, like the previous times, but I deleted all my Stripe accounts. This time it worked! No hiccup, this is fantastic. Thank you for your help @thorwebdev!
from nextjs-subscription-payments.
I added envrionment variables these way in vercel:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: '....'
STRIPE_SECRET_KEY: '...'
STRIPE_WEBHOOK_SECRET: '...'
couldn't get it work ever
commented out my local listener webhook secret and added the one for vercel endpoint in next.config.js, and it worked
from nextjs-subscription-payments.
anything on this?
from nextjs-subscription-payments.
Related Issues (20)
- Getting ECONNREFUSED when starting `npm run dev` HOT 1
- Breaking Change by Stripe: Example needs overhaul HOT 1
- Defining the "Main Deployment URL" HOT 2
- Type error `priceData` HOT 3
- Stuck after setting up Supabase when using "Deploy Now" HOT 4
- Feature Request: Documentation
- Cannot setup supabase local instance HOT 2
- Can't import shadcn button component HOT 2
- Vercel Deploy Button setup process broken HOT 1
- updateName doesn't update the name in account page HOT 14
- --turbo flag breaks dependencies HOT 2
- pnpm supabase:pull and pnpm supabase:push missing "db" HOT 1
- [help] How to import shadcn components in dark mode? HOT 2
- Slow Auth Loading
- Failing build HOT 1
- How to set up free trial payment option? HOT 4
- UserName is not Updating the users table, instead the Main Auth
- Vercel Deploy button - Infinite Completing Installation...
- Deprecating `auth-helpers` HOT 2
- 'Lifetime' feature on Pricing component does not work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextjs-subscription-payments.