T
tRPC

How to limit payload size?

How to limit payload size?

Aaryzing11/1/2023
Is there a way to limit the payload size? E.g., if a particularly large JSON payload is sent to the (standalone) server, the server should stop after having read a set number of bytes and fail the request.
Aaryzing11/1/2023
Seems a raw Node.js server would work with something similar to the following, however the 'data' event inside createContext is not firing
opts.req.on("data", (chunk) => {
console.log("Received chunk with size: ", chunk.size);
});
opts.req.on("data", (chunk) => {
console.log("Received chunk with size: ", chunk.size);
});
Is the data already received by the time createContext is ran?

Looking for more? Join the community!

T
tRPC

How to limit payload size?

Join Server