#louis-tam_webhooks

1 messages · Page 1 of 1 (latest)

hearty raftBOT
#

👋 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.

vagrant tide
quiet axle
#

hi there!

#

what's the exact command you are running? and what's the exact error you see?

vagrant tide
#

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

quiet axle
#

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

vagrant tide
#

my backend routes were not changed since the last time I ran this and I am running on local right now

quiet axle
#

can you double check that your server is running, the routes are working, and you have to errors in your backend logs?

vagrant tide
#

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?

quiet axle
#

can you try with curl (or something similar) to send a POST request to localhost:5000/webhook?

vagrant tide
#

ok let me try with postman hang on

#

its tellingme no stripe-signature header value - i put this inunder headers

quiet axle
#

that's normal. but at least you didn't get a 404 error?

hearty raftBOT
vagrant tide
#

no it said Webhook Error: No stripe-signature header value was provided.

elder ember
#

Hello
Have you tried re-running the stripe listen command?
404s can also be caused by typos in the URL

vagrant tide
#

yes I restarted the CLI using stripe listen --forward-to localhost:5000/webhook and it'sconnected. same result

elder ember
#

Can you share the exact 404 message? A screenshot would help too.

Also any code you've written under /webhook path

vagrant tide
#

Payment failed:

elder ember
#

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?

vagrant tide
elder ember
#

Isn't your server running on localhost:5000 ? Or do you have two separate servers?

vagrant tide
#

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>

elder ember
vagrant tide
#

yes my frontend is 3000 and backend is 5000

elder ember
#

Gotcha. So that's the issue.. Your frontend is calling itself when trying to create checkout session

#

instead of calling your backend

vagrant tide
#

Sorry am i'm a bit confused what i an supposed to change inthe code. am i getting rid of create-checkout-sessoin?

elder ember
#

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

vagrant tide
#

If i change this on my frontend it still gives me 404

elder ember
#

Can you share the exact error please?

vagrant tide
#

same ones as before

elder ember
#

what happens if you make a POST request to http://localhost:5000/api/stripe/create-checkout-session via postman?

vagrant tide
hearty raftBOT
elder ember
#

Seems like there's some bug in your backend code that causes /create-checkout-session path to be unavailable

#

You'd want to debug and resolve that issue

#

As it is unrelated to Stripe, I don't think we'd be able to help much

vagrant tide
#

oh i found out what it was. this accidentallly got deleted app.use("/api/stripe", stripeRoutes);

#

thanks youboth for looking into this with me