diff --git a/packages/next/src/experimental/testmode/server.ts b/packages/next/src/experimental/testmode/server.ts index 44816a14c7d7d3..4833e712af6dbb 100644 --- a/packages/next/src/experimental/testmode/server.ts +++ b/packages/next/src/experimental/testmode/server.ts @@ -69,9 +69,15 @@ export function createTestFetch(originalFetch: Fetch): Fetch { input: FetchInputArg, init?: FetchInitArg ): Promise { + // Passthrough internal requests. + // @ts-ignore + if (init?.next?.internal) { + return originalFetch(input, init) + } + const testInfo = testStorage.getStore() if (!testInfo) { - return Promise.reject(new Error('No test info')) + throw new Error('No test info') } const { testData, proxyPort } = testInfo