Skip to content

Commit

Permalink
Set body-parser size limits to 10MB (#1386)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coletrane authored and samtstern committed Jun 11, 2019
1 parent 6492495 commit 127ea58
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
* Fixes bug in Firestore emulator where property paths with special characters would cause errors due to ClassNotFound exceptions.
* Fixes bug in Firestore emulator where auto-id allocation only worked once per collection.
* Adds REST API to Firestore emulator for setting security rules.
* Fixes bug where `firebase emulators:exec` would succeed even if the script failed.
* Functions emulator now limits request sizes to 10MB.
* Fixes bug where `firebase emulators:exec` would succeed even if the script failed.
26 changes: 22 additions & 4 deletions src/emulator/functionsEmulatorRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,28 @@ async function ProcessHTTPS(frb: FunctionsRuntimeBundle, trigger: EmulatedTrigge
};

ephemeralServer.enable("trust proxy");
ephemeralServer.use(bodyParser.json({}));
ephemeralServer.use(bodyParser.text({}));
ephemeralServer.use(bodyParser.urlencoded({ extended: true }));
ephemeralServer.use(bodyParser.raw({ type: "*/*" }));
ephemeralServer.use(
bodyParser.json({
limit: "10mb",
})
);
ephemeralServer.use(
bodyParser.text({
limit: "10mb",
})
);
ephemeralServer.use(
bodyParser.urlencoded({
extended: true,
limit: "10mb",
})
);
ephemeralServer.use(
bodyParser.raw({
type: "*/*",
limit: "10mb",
})
);

ephemeralServer.all("/*", handler);

Expand Down

0 comments on commit 127ea58

Please sign in to comment.