#louis-tam_webhooks
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1263109504384630847
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
The repo is here. I cannot figure out why the post requests were working just a few weeks ealrier but now stopped working entirely despite the striperoutes not being changed at all https://github.com/Louistam888/RCCF3/tree/reviews
Contribute to Louistam888/RCCF3 development by creating an account on GitHub.
hi there!
what's the exact command you are running? and what's the exact error you see?
hi ive run stripe login and stripe listen --forward-to localhost:5000/webhook to start the CLI.
everything starts up. but when i try to create the checkout session all of a sudden it has started throwing 404 POST errors
it has started throwing 404 POST errors
so it's actually your server that is returning the 404 error, not the Stripe CLI
so you need to check your server logs to understand the issue
my backend routes were not changed since the last time I ran this and I am running on local right now
can you double check that your server is running, the routes are working, and you have to errors in your backend logs?
Not seeing any erorrs in termial and running localhost:5000 in the browser shows Response from Get Route - so I guess the server is running?
can you try with curl (or something similar) to send a POST request to localhost:5000/webhook?
ok let me try with postman hang on
its tellingme no stripe-signature header value - i put this inunder headers
that's normal. but at least you didn't get a 404 error?
no it said Webhook Error: No stripe-signature header value was provided.
Hello
Have you tried re-running the stripe listen command?
404s can also be caused by typos in the URL
yes I restarted the CLI using stripe listen --forward-to localhost:5000/webhook and it'sconnected. same result
Can you share the exact 404 message? A screenshot would help too.
Also any code you've written under /webhook path
Hi it's giving me inb XHRPOST
http://localhost:3000/api/stripe/create-checkout-session
[HTTP/1.1 404 Not Found 7ms]
Payment failed:
That error isn't from your webhook
It seems to be returned by your code that creates a checkout session
OR more like it can't find the http://localhost:3000/api/stripe/create-checkout-session path
what happens if you try to make a POST to http://localhost:3000/api/stripe/create-checkout-session via Postman?
This iswhere the post req is made on the frotned https://github.com/Louistam888/RCCF3/blob/reviews/client/src/components/CheckoutOrderSummary.jsx
Isn't your server running on localhost:5000 ? Or do you have two separate servers?
in postman it says <html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /api/stripe/create-checkout-session</pre>
</body>
</html>
Are you running separate servers for your frontend code and backend code?
Your frontend code is making a request to localhost:3000 but based on your webhook URL, your backend code serves on localhost:5000
Can you confirm if request to localhost:3000 is expected here? If not, you'd want to change the URL to localhost:5000 here: https://github.com/Louistam888/RCCF3/blob/reviews/client/src/components/CheckoutOrderSummary.jsx#L74
yes my frontend is 3000 and backend is 5000
Gotcha. So that's the issue.. Your frontend is calling itself when trying to create checkout session
instead of calling your backend
Sorry am i'm a bit confused what i an supposed to change inthe code. am i getting rid of create-checkout-sessoin?
No.. your code by default makes a POST request to http://localhost:3000/api/stripe/create-checkout-session
localhost:3000 is your client-side server
You need to change the URL in your POST request to http://localhost:5000/api/stripe/create-checkout-session so that the request goes to your backend code
If i change this on my frontend it still gives me 404
Can you share the exact error please?
same ones as before
what happens if you make a POST request to http://localhost:5000/api/stripe/create-checkout-session via postman?