#farhanah-webhook-nextjs

1 messages · Page 1 of 1 (latest)

brazen roseBOT
flat vector
#

Hey @velvet verge ! What's your question?

velvet verge
#

hello there!

flat vector
#

farhanah-webhook-nextjs

velvet verge
#

i'm a bit confused as towhy my method is showing as "GET" and i do not see any stripe signature in my headers. i suspect i'm missing a post request somewhere but not too sure where i need to make that post request?

flat vector
#

We (Stripe) make the an HTTP POST request to your webhook endpoint on your server, the rest is in your own systems

brazen roseBOT
flat vector
#

Unfortunately you didn't give much, just a link + "I made changes"

velvet verge
#

how can i test locally then? my endpoint is already configured in stripe

flat vector
#

not sure what any of this could mean I'm really sorry. Right now this is super vague and high level. We (Stripe) send an HTTP POST request to your server's endpoint.
If you are developing locally with localhost and such you can use our Stripe CLI tool https://stripe.com/docs/cli or a third-party like https://grok.com for example

velvet verge
#

yes ive tried the stripe cli tool and triggered an event (subscription_schedule.released). but once it hits my endpoint it gives me a 405 error and i suspect its the signature

flat vector
#

sure, so the next step is to debug that issue. Add clear logs, understand what's failing, debug that. Like are you using the right secret? The CLI has its own which is printed when you do stripe listen
I'm sorry, you seem to have a ton more context but didn't really share it in multiple back and forth so it's hard to help properly but if you have a clear question with where you are at, what your own logs show, what you code does, etc. we're happy to help
My advice is to log the request as it comes in before any signature verification to confirm

velvet verge
#

once i log it (before the signature verification), my method shows as GET and my header do not include the stripe signature in them

#

as for the secret, i took that directly from the stripe cli when i ran stripe listen --forward-to xyz

flat vector
#

I don't really understand what "my method shows as GET" could mean unfortunately I'm sorry

velvet verge
#

my code is verifying the signature and upon a certain event it will execute some code

#

when i log req.method is shows as GET. it should show as POST since stripe is doing a post request

nimble sun
#

How are you generating test events to get forwarded?

#

Are you using stripe trigger or something else?

velvet verge
#

through the stripe cli - jsut triggering them

#

like this 'stripe trigger subscription_schedule.updated '

nimble sun
#

It certainly should not be a GET request, it should be a POST so I wonder if that's coming from somewhere else

velvet verge
#

this is the disconnect that i'm having trouble with

#

now my endpoint is my prod link, but i'm trying to just test locally for now (i am using the local webhook secret) so i'm not sure if thats the issue

#

by prod link - i mean my production endpoint instead of localhost:3000

#

hello?

nimble sun
#

Hi there

#

I think you need to investigate the source of these GET requests, this isn't something I'd expect is coming from Stripe or the CLI

velvet verge
#

do you have a starting point on where i should be looking? i am using nextjs tohandle the stripe requests. export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {

nimble sun
#

I'm not deeply familiar with next.js conventions unfortunately, but extrapolating from Express.js I've never seen webhook requests (direct or via CLI) present as GETs, that doesn't make sense

#

The only path i can think of is if you're explicitly proxying the POST requests somewhere and redirecting them as GETs