#Arkham-webhook-testing

1 messages · Page 1 of 1 (latest)

smoky copper
#

Hi there 👋 it looks like your server returned a 405 status when it received the test webhook event.

#

It's hard for us to say why that happened.

brazen shore
#

How should I proceed?

smoky copper
#

You'll need to look at your processing logic to see if there is a case where it is explicitly returning a 405, and if it's not then you'll need to take a look at your environment to try determining why that response was sent.

brazen shore
#

It’s odd, in the logs we get 200 ok

smoky copper
#

That's a different event from the test event that you showed initially

brazen shore
#

But when I send the test event I get the 405 error

#

One moment

charred fossil
#

like this we set the webhook and sent the subscribe

#

in this case we got the 405 error even though the subscription is success

#

but if I see the logs, it says that the status is ok as 200

smoky copper
#

Those statuses have nothing to do with the operations inside of Stripe, for example, a subscription creation will not fail because your webhook event handler returned an error code. For webhook events we (Stripe) are sending information to your server, and your server then responds to that letting us know whether or not it received the data. When you're seeing a 405 error that's because your server is returning a 405 to us.

charred fossil
#

well...

smoky copper
#

When I tried hitting your endpoint emulating our webhook events, I received a 405, and when I hit it via a browser I got a 304 that sent me to a login page. Is that URL properly configured for POST calls within your Vercel environment?

charred fossil
#

yes. the site has the post call

#

also when I try with local, I got this error

smoky copper
#

What is the endpoint you're trying to use? In the webhook endpoint that's set to capncovers.com/api/webhooks but when you tried to ping locally the address didn't contain /api.

charred fossil
#

yes

smoky copper
#

Well it seems like something in your environment is refusing to accept POST calls to that endpoint. Unfortunately we don't have insight into the operation of your server, other than the errors that it returns to us, so there isn't much guidance we can provide and you'll be best suited to troubleshoot why it's behaving this way.

charred fossil
#

ok got it

#

also last question

smoky copper
#

Sure

charred fossil
#

I was using the ngrok url for webhook, in this case I got the 404 error

#

like this

#

do you think what the issue is?

smoky copper
#

404 usually indicates that a page isn't found. You should double check that the address is correct, and that the address is accessible.

charred fossil
smoky copper
#

Yup

charred fossil
#

just it works

smoky copper
#

Again, those are two different addresses. The top ends in /dashboard and the webhook endpoint is pointing to an address that ends in /webhook.

charred fossil
#

then in the real address(site url), webhook url has to be existed?

#

like this?

#

I created the webhook url like site one

#

but in this case I got the 404

#

what is wrong on the webhook setting?

drowsy hinge
charred fossil
#

let me check

charred fossil
#

in case i check the webhook on the local, which secret endpoint should I use?

drowsy hinge
#

As in you are using the stripe listen CLI command?

#

In that case you would use the secret that the CLI prints when you start the listen command

charred fossil
#

yes

#

I got the webhook

#

if I use this code, I got the errors

#

what is the reason?

#

in this case the webhook is working

drowsy hinge
#

What is the error you are seeing?

charred fossil
charred fossil
drowsy hinge
#

You are seeing your code get hit and it is still returning a 404 or 405?

charred fossil
#

yes

drowsy hinge
#

So what exactly is the flow when it is in your code?

#

Does constructEvent return successfully?

charred fossil
#

one a sec

#

one a sec

drowsy hinge
#

That sounds like your code is still not being reached

#

Because your code does not return a 405 error, it returns a 400 if it runs in to an error

#

Can you send me the event ID (evt_123) from your screenshot?

charred fossil
#

I got this error

charred fossil
# charred fossil

for this the website is not active, so I was getting the 405 error

drowsy hinge
#

It sounds like you need to troubleshoot your server configuration

#

If the webhooks messages aren't even getting to your code, that needs to be addressed first

charred fossil
#

let me check again

charred fossil
#

also one questioin

#

I got the webhook and I am going to use it on the client side

#

on the UI part, how to do in order to get the subscription object?

#

also how can I fix this this error?

winter kayak
#

Let's start with the webhook error - that means your signature verification is failing because something is not matching up. This could be that you're using the wrong endpoint secret, or you're accidentally modifying the raw body of the request

#

Are you testing with the Stripe CLI?

charred fossil
#

yes

charred fossil
#

using the rawbody

winter kayak
#

Does the endpoint secret you're using match what's in the dashboard?

charred fossil
winter kayak
#

You should be able to find it when you click on the webhook endpoint

charred fossil
#

this/

#

signing secret?

winter kayak
#

Yes, you want to make sure that matches

charred fossil
#

same error

#

secret key is matched

winter kayak
#

If the secret key matches then it's likely something to do with your middleware modifying the raw body. Are you using express?

charred fossil
#

yes

#

express

#

like this I am using

winter kayak
charred fossil
#

same error

winter kayak
#

There's a lot of different solutions given there - so I'd really suggest you take a look at a variety of them and see what works. If you're sure the endpoint secret is correct, then the issue is almost certainly with the raw body

charred fossil
#

working now

#

I got the webhook and I am going to use it on the client side
on the UI part, how to do in order to get the subscription object?

#

I set in order to get the response data from webhook

#

but the data is not wanted one

winter kayak
#

Are you saying you're trying to get the events from your webhook and send them client-side?

charred fossil
#

yes

#

also when send the subscritpion, webhook status is 200 , but when I got the response, its status is 400

winter kayak
#

That's not how it works - a better option would be to call out to a different endpoint on your server to check for something more specific. Like if you want to check the status of the subscription you'd retrieve the subscription from stripe or your database

charred fossil
#

how can I retrieve the subscription?

#

a little make sense

winter kayak
charred fossil
#

let me try

#

how to set this part?

winter kayak
#

That would be the subscription Id you're trying to retrieve....

#

You need to take a step back and think through what exactly you're trying to do and read through our documentation.

#

If the Subscription ID isn't something you have client-side you need to look at what other information you have available