#ortega_node-signature

1 messages ¡ Page 1 of 1 (latest)

fathom rockBOT
#

👋 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/1300474031665057896

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

outer heart
#

Hi Pompey!

indigo flax
#

Hello, can you tell me more about what is going wrong when these events get sent to you?

outer heart
#

This log gives me the backend:

#

Raw body: [object Object]
⚠️ Webhook signature verification failed. Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the raw request body.Payload was provided as a parsed JavaScript object instead.
Signature verification is impossible without access to the original signed material.
Learn more about webhook signing and explore webhook integration examples for various frameworks at https://github.com/stripe/stripe-node#webhook-signing

#

Create the webhook directly from the control panel

indigo flax
#

Gotcha, this doc should be helpful. I would reccommand checking the endpoint secret and signature to make sure they are set properly in your code first because they are quick to check. If both of those work, then the issue is likely that your endpoint isn't passing the event's raw body to the construct event method https://docs.stripe.com/webhooks/signature

outer heart
#

Yes, I already saw that, as I said, I created it from the dashboard. I copied the signing secret and pasted it into my backend's .env file.

#

What I don't understand is how to verify the secret.

indigo flax
#

Typically just printing it out and making sure it is set to the value that you expect. If that works then this is likely the raw body issue, I just always reccommend checking this first as it quicker and more straightforward to check

outer heart
#

Ok, I compile the app and see that the backend is responding to me.

fathom rockBOT
tiny loom
#

ortega_node-signature

fathom rockBOT
outer heart
#

Hi Snufkin!

tiny loom
outer heart
#

This is my code in backend to test if the signature works

#

I get this message:

⚠️ Error verifying signature: Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the raw request body.Payload was provided as a parsed JavaScript object instead.
Signature verification is impossible without access to the original signed material.
Learn more about webhook signing and explore webhook integration examples for various frameworks at https://github.com/stripe/stripe-node#webhook-signing

Why?

tiny loom
#

@outer heart did you read that doc that is linked?

outer heart
#

Which?

tiny loom
#

there's a clear error message that you copy-pasted above. Did youread that message? It tells you what the issue is and it links you to a clear URL that explains the problem and potential solutions

outer heart
#

Yes I know, but I check each URL and configure it as it tells me but it responds the same way.

tiny loom