-
Notifications
You must be signed in to change notification settings - Fork 97
Description
when attempting to use the patreon webhook with smee.io, The server ends up hanging when trying to parse the payload. I get no response from the server until I shut down the smee client, then the server spits out this error:
BadRequestError: request aborted
[server] at IncomingMessage.onAborted (...node_modules\raw-body\index.js:238:10)
[server] at IncomingMessage.emit (node:events:513:28)
[server] at IncomingMessage._destroy (node:_http_incoming:224:10)
[server] at _destroy (node:internal/streams/destroy:109:10)
[server] at IncomingMessage.destroy (node:internal/streams/destroy:71:5)
[server] at abortIncoming (node:_http_server:696:9)
[server] at socketOnClose (node:_http_server:690:3)
[server] at Socket.emit (node:events:525:35)
[server] at TCP.<anonymous> (node:net:757:14)
The same exact code works in production when getting the request directly from Patreon webhook.
Also the smee.io site is able to display the payload without issue, it just cant seem to forward it correctly to the target.
I created a super simple express server to test and make sure there wasn't another setting I had on my server that was interfering but go the same results:
import express from 'express'
import http from 'http'
const app = express()
app.post('/webhook/patreon', express.json(), (req, res) => {
console.log('Received request')
console.log(req.body)
res.sendStatus(200)
})
const server = new http.Server(app)
const port = 3000
server.listen(port, () => {
console.log('Listening on port', port)
})
I believe it has something to do with the payload being formatted differently from what is in the original webhook request, because removing the express.json() parsing does get the request to go through, but the body is empty in that case, so it is having trouble parsing the payload correctly.
I would guess it is something weird Patreon is doing with its payload that is not being accounted for since everyone else does not seem to have issues using it with other webhooks. I noticed a previous issue with content-length being changed from removing white-spacing causing a similar result so perhaps it is has something to do with that.