Skip to content

Parser does not work in serverless environment #608

@czarny

Description

@czarny

Environment information

Version:
"body-parser: 1.20.3
"express": "^5.1.0",
"serverless-http": "^3.2.0",

Platform:
Service is deployed to as AWS Lambda.

Any other relevant information:

Latest express release uses body-parser which uses on-finished to determine if body should be parsed.

The on-finished checks socket.readable property to determine if request is finished (https://github.com/jshttp/on-finished/blob/master/index.js#L76).

The serverless-http sets readable to false (https://github.com/dougmoscrop/serverless-http/blob/master/lib/request.js#L9) when creating request object for express.

This causes that body-parser skips body parsing (https://github.com/expressjs/body-parser/blob/master/lib/types/json.js#L87) because request is considered finished.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions