#saiki_webhooks

1 messages ยท Page 1 of 1 (latest)

mystic turretBOT
#

๐Ÿ‘‹ 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/1418347200706117815

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

twin sedge
#

Hi @native wind, I'd like to know if there is a way to replicate this rawBody rule in nodejs. I'm having a hardtime checking the signature because im not able to get the expected rawBody

native wind
#

Hi there!

twin sedge
#

Hi!

native wind
#

Do you mean you're writing a webhook handler in node.js and you are asking how to make sure you have the raw body of the event? If yes, most people doing servers in node are using express and use the express.raw method

twin sedge
#

I'm using the API Gateway + Lambda combo

#

Which kind of messes the raw body

native wind
#

and you tried the suggestion here ?

twin sedge
#

Yes, and it didn't work because of some authorization matters

#

because the proxy would handle the auth

native wind
#

What information do you have for debugging? What kind of errors do you have, etc? An example webhook event might also help

twin sedge
#

can you see a lipeefsilva_webhooks topic in the #dev-help channel?

#

it had a lot of data written

#

but was closed for somereason

#

i'm there, too

#

this one

native wind
#

We always close threads when they become inactive for a certain time

#

I'm reading your previous thread

twin sedge
#

Ok, thanks

#

hey @native wind i think i had progress with the link you sent about the webhook builder

#

now the buffer looks more like expected

#

I am sure that the secret is correct, and the signature provided is also in the expected format

#

Also, the body is being shown as a buffer

#

I'm not quite sure what is different

native wind
#

My assumption is that something is modifying the request body

twin sedge
#

possibly the API Gateway?

#

Do you know of a way I could work around that?

#

like possibly checking in another way or replicating what the body mapping template would be doing

native wind
#

in this github issue which one of my teammates answered, the asker eventually fixed their issue and said this:

I'm using Serverless, and needed to redeploy my whole stack. You'll have to do similar with whatever tool you're using to get API gateway to send the rawbody attribute (this didn't seem necessary for me for other mappings like IP address, so not sure whats going on)

#

did you do anything like that after adding the body mapping template?

twin sedge
#

Let me try that again. In the first try it failed because of the authentication middleware

native wind
#

also are you using the signing secret you get from the dashboard, or the CLI?

twin sedge
#

cli

#

because this is a test

mystic turretBOT
civic depot
#

๐Ÿ‘‹ Taking over this thread, catching up now

#

Are you forwarding the event to your server endpoint using the CLI?

#

Or do you receive the event directly with the endpoint set up directly in the Dashboard?

twin sedge
#

Yes!

#

I'm using the CLI for all the tests

civic depot
#

If you spin up the simple express server with the same code, and forward event to this server, will that work?

twin sedge
#

Let me try that

civic depot
#

If this approach works, then the issue isn't likely due to the code, but the config in API Gateway

twin sedge
#

working on that

#

Yes

#

it worked

civic depot
#

In this case, we can conclude that the issue is likely stemmed from the API Gateway that the event might have been modified and no longer in the raw form

twin sedge
#

i'm having a hard time even following those instructions

civic depot
#

Did you manage to resolve the authentication failure with the template content suggested in the doc

Resolve webhook signature verification errors, and check the endpoint secret, check the request body, retrieve the raw request body, and check the signature.

twin sedge
#

Hi, I'll be logging off but be back tomorrow morning to work on this

#

thank you guys for all the help

civic depot
#

No problem! Happy to help ๐Ÿ˜„