You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using @mockoon/serverless with Firebase Functions, the body is already parsed which doesn't trigger the 'data' event. Our body parser is hanging, waiting for a 'data' event that is never coming, and thus the whole function is hanging up.
This happens every time there is a body with a parseable Content-Type (no matter the method).
Steps to Reproduce
Use the minimal setup (see serverless repo) and send a body to a POST route for example.
Call POST /test with a Content-Type: application/json header and a body.
Solution
Either add a disableBodyParsing option to the server (and a corresponding CLI flag/serverless param), or update the body parser to automatically detect that the body was already parsed (maybe a better option).
Describe the bug
When using @mockoon/serverless with Firebase Functions, the body is already parsed which doesn't trigger the 'data' event. Our body parser is hanging, waiting for a 'data' event that is never coming, and thus the whole function is hanging up.
This happens every time there is a body with a parseable Content-Type (no matter the method).
Steps to Reproduce
Use the minimal setup (see serverless repo) and send a body to a POST route for example.
mock.json
Call
POST /test
with aContent-Type: application/json
header and a body.Solution
Either add a
disableBodyParsing
option to the server (and a corresponding CLI flag/serverless param), or update the body parser to automatically detect that the body was already parsed (maybe a better option).Sources:
https://stackoverflow.com/questions/63968953/why-do-i-get-a-502-gateway-error-from-nextjs-app-hosted-on-firebase-for-post-r/63975702#63975702
https://stackoverflow.com/questions/58237305/post-request-hangs-timeout-when-trying-to-parse-request-body-running-koa-on-f
https://dev.to/3imed_jaberi/koa-bodyparser-with-firebase-cloud-functions-4ogk
Mockoon version:
all
OS / OS version:
all
The text was updated successfully, but these errors were encountered: