[next] Ensure only pages enable streaming (#11660)

This fixes a regression introduced by #11625 that enabled streaming for
routes on the pages router (these routes do not support streaming).
This commit is contained in:
Wyatt Johnson
2024-05-24 16:15:32 -06:00
committed by GitHub
parent a26ea7bf12
commit c9d53d4e3e
3 changed files with 14 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
---
'@vercel/next': patch
'vercel': patch
---
Don't create streaming lambdas for pages router routes

View File

@@ -947,6 +947,10 @@ export async function serverBuild({
const appRouterStreamingActionLambdaGroups: LambdaGroup[] = [];
for (const group of appRouterLambdaGroups) {
if (!group.isPrerenders || group.isExperimentalPPR) {
group.isStreaming = true;
}
group.isAppRouter = true;
// We create a streaming variant of the Prerender lambda group
@@ -961,6 +965,9 @@ export async function serverBuild({
}
for (const group of appRouteHandlersLambdaGroups) {
if (!group.isPrerenders) {
group.isStreaming = true;
}
group.isAppRouter = true;
group.isAppRouteHandler = true;
}

View File

@@ -1508,7 +1508,7 @@ export type LambdaGroup = {
maxDuration?: number;
isAppRouter?: boolean;
isAppRouteHandler?: boolean;
readonly isStreaming: boolean;
isStreaming?: boolean;
readonly isPrerenders: boolean;
readonly isExperimentalPPR: boolean;
isActionLambda?: boolean;
@@ -1565,7 +1565,6 @@ export async function getPageLambdaGroups({
const routeName = normalizePage(page.replace(/\.js$/, ''));
const isPrerenderRoute = prerenderRoutes.has(routeName);
const isExperimentalPPR = experimentalPPRRoutes?.has(routeName) ?? false;
const isStreaming = !isPrerenderRoute || isExperimentalPPR;
let opts: { memory?: number; maxDuration?: number } = {};
@@ -1637,7 +1636,6 @@ export async function getPageLambdaGroups({
...opts,
isPrerenders: isPrerenderRoute,
isExperimentalPPR,
isStreaming,
isApiLambda: !!isApiPage(page),
pseudoLayerBytes: initialPseudoLayer.pseudoLayerBytes,
pseudoLayerUncompressedBytes: initialPseudoLayerUncompressed,