Skip to content

Commit

Permalink
fix(dev): increase serverless function POST limit (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkilpatrick authored Sep 17, 2024
1 parent f27199a commit 1b9de9e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/pages/src/dev/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { getModuleInfoFromModuleName } from "./ssr/findMatchingModule.js";
import open from "open";

const __dirname = dirname(fileURLToPath(import.meta.url));
const SERVERLESS_FUNCTION_POST_REQUEST_LIMIT = "50mb";

/**
* @internal
Expand All @@ -39,8 +40,13 @@ export const createServer = async (
const app = express();

// necessary for serverless functions' req.body to be available
app.use(express.json()); // used to parse JSON bodies
app.use(express.urlencoded({ extended: true })); // parse URL-encoded bodies
app.use(express.json({ limit: SERVERLESS_FUNCTION_POST_REQUEST_LIMIT })); // used to parse JSON bodies
app.use(
express.urlencoded({
limit: SERVERLESS_FUNCTION_POST_REQUEST_LIMIT,
extended: true,
})
); // parse URL-encoded bodies

// initialize the default project structure and use to help configure the dev server
const projectStructure = await ProjectStructure.init({ scope });
Expand Down

0 comments on commit 1b9de9e

Please sign in to comment.