assertPreBufferedBodyWithinLimit()
function assertPreBufferedBodyWithinLimit(body, bodyLimit?): Promise<void>;
Defined in: src/receivers/HTTPModuleFunctions.ts:29
Rejects a request body that was already read into memory before Bolt saw it, when it is larger than bodyLimit.
Some environments, like Google Cloud Functions and Cloud Run with @google-cloud/functions-framework, set
req.rawBody before the receiver runs, so raw-body never reads the stream and its limit never applies.
Passing the known length to raw-body makes it reject an oversized body before reading it, with the same
entity.too.large error and limit parsing as the stream path, so receivers respond with a 413.
Parameters
body
string | Buffer
bodyLimit?
string | number
Returns
Promise<void>