Skip to content

Commit 8689f00

Browse files
authored
fix(server): update request body size (#102)
This changes the limit for the request body size from 100kb to 6mb which is the default for Lambda/Twilio Functions fix #98
1 parent 726d66f commit 8689f00

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/runtime/server.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import { getDebugFunction } from '../utils/logger';
1414
import { createLogger } from './internal/request-logger';
1515
import { setRoutes } from './internal/route-cache';
1616
import { getFunctionsAndAssets } from './internal/runtime-paths';
17-
import { functionToRoute, constructGlobalScope } from './route';
17+
import { constructGlobalScope, functionToRoute } from './route';
1818

1919
const debug = getDebugFunction('twilio-run:server');
2020
const DEFAULT_PORT = process.env.PORT || 3000;
21+
const DEFAULT_BODY_SIZE_LAMBDA = '6mb';
2122

2223
function requireUncached(module: string): any {
2324
delete require.cache[require.resolve(module)];
@@ -50,8 +51,10 @@ export async function createServer(
5051

5152
const app = express();
5253
app.use(userAgentMiddleware.express());
53-
app.use(bodyParser.urlencoded({ extended: false }));
54-
app.use(bodyParser.json());
54+
app.use(
55+
bodyParser.urlencoded({ extended: false, limit: DEFAULT_BODY_SIZE_LAMBDA })
56+
);
57+
app.use(bodyParser.json({ limit: DEFAULT_BODY_SIZE_LAMBDA }));
5558
app.get('/favicon.ico', (req, res) => {
5659
res.redirect(
5760
'https://www.twilio.com/marketing/bundles/marketing/img/favicons/favicon.ico'

0 commit comments

Comments
 (0)