#Monimolimnion

1 messages ยท Page 1 of 1 (latest)

pseudo tendonBOT
tranquil oriole
#

This is just from my local development server btw

#

nvm, somehow my secret key env variable got deleted ๐Ÿซฃ

formal sandal
#

All set now then?

tranquil oriole
#

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.

formal sandal
#

You need to ensure you provide the raw request body string that was sent, not parsed json

tranquil oriole
#

hmm

formal sandal
#

If you have express/bidy-parser set up to parse request payloads as json you'll need to exclude the webhook endpoint from that, or otherwise preserve the raw body string

tranquil oriole
#

I'm not parsing anything as JSON

#

unless Sveltekit is doing it without my knowledge

formal sandal
#

That's very possible, I've not sure how that framework works

tranquil oriole
#

I've seen const payload = Buffer.from(request.body) suggested

#

but then I get TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of ReadableStream

#

ah, got it I think

#

const payload = await request.text()

#

for future reference ๐Ÿ™‚

formal sandal
#

Ah, nice. Thanks. I'll file that away in my brain notes ๐Ÿ˜„

#

Did you find a source for that in their docs?