Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(docsite): a proxied fetch opens its own connection, so a server closing an idle socket can't reset it (#9106)

Christopher Chedeaude8308de79fc
diff --git a/apps/docsite/e2e/internal-docs-prompt.spec.ts b/apps/docsite/e2e/internal-docs-prompt.spec.ts
index b921989cf9..71e83d9022 100644
--- a/apps/docsite/e2e/internal-docs-prompt.spec.ts
+++ b/apps/docsite/e2e/internal-docs-prompt.spec.ts
@@ -40,6 +40,11 @@ async function servePublicOrigin(
const url = new URL(route.request().url());
const response = await route.fetch({
url: `${baseURL}${url.pathname}${url.search}`,
+ // A new connection for each proxied request. Playwright's request client
+ // keeps idle sockets open with no timeout of its own, and `next start`
+ // closes one after six idle seconds: a request sent on it as it closes
+ // is reset, and the page it was loading never hydrates.
+ headers: {...route.request().headers(), connection: 'close'},
});
await route.fulfill({response});
});
diff --git a/apps/docsite/e2e/playground-preview-isolation.spec.ts b/apps/docsite/e2e/playground-preview-isolation.spec.ts
index 201d1f2344..8e572d7d83 100644
--- a/apps/docsite/e2e/playground-preview-isolation.spec.ts
+++ b/apps/docsite/e2e/playground-preview-isolation.spec.ts
@@ -160,7 +160,11 @@ test.describe('playground preview isolation', () => {
await page.route(
/\/_next\/static\/chunks\/main-app-[^/]+\.js/,
async route => {
- const response = await route.fetch();
+ // A new connection, so a kept-alive socket that `next start` closes
+ // for idleness cannot reset this fetch.
+ const response = await route.fetch({
+ headers: {...route.request().headers(), connection: 'close'},
+ });
const body = await response.text();
const runtimeStart = body.indexOf('(self.webpackChunk_N_E=');
expect(runtimeStart).toBeGreaterThan(0);