parse-community / parse-community/parse-server
Webhooks not passing content-length header to POST request
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
When using Moralis (built on top of Parse), I realized that the webhooks are not passing the content-length header to the POST request that Parse makes under the hood. This causes services like Vercel, which use body-parser under the hood, to receive an empty body in req.body. From looking at the code I don't see the content-header get added. I opened an issue in the moralis forum too: https://forum.moralis.io/t/webhooks-send-empty-body-to-vercel-api/3361/5.
Steps to reproduce
- Set up a webhook.
- Point the webhook to a Vercel serverless function: https://vercel.com/docs/concepts/functions/introduction.
- Trigger the webhook so it calls the Vercel serverless function. Inspect
req.bodyandreq.headersinside Vercel logs and see an empty body (where the moralis body was expected) and see that there is nocontent-lengthheader.
Actual Outcome
The webhook data gets lost when calling the Vercel endpoint and the request body can't be used.
Expected Outcome
The content-length should be included in the webhook request so the JSON body can be correctly parsed by whoever is handling the webhook call.
Environment
Not sure what to put here. It happens in the latest version (from looking at the code).
Server
- Parse Server version: not sure since I do not have access to know what version Moralis is using under the hood.
- Operating system: same as above.
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): same as above.
Database
- System (MongoDB or Postgres): MongoDB
- Database version: same as above.
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): same as above.
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript.
- SDK version: same as above.
Logs
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Parse Server's webhook POST request handling and reproduce the call against the Vercel serverless function described in the issue. Confirm that the request includes a content-length header and that the webhook JSON is available in req.body, then verify the behavior with a focused test if the relevant test location can be identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript, nodejs
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100