Skip to content

Commit 8972e5b

Browse files
authoredFeb 7, 2024
fix: use unpatched fetch for all deploystores (#240)
1 parent 00662dc commit 8972e5b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎src/run/headers.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export const setVaryHeaders = (
7575
headers.set(`netlify-vary`, generateNetlifyVaryValues(netlifyVaryValues))
7676
}
7777

78+
const fetchBeforeNextPatchedIt = globalThis.fetch
79+
7880
/**
7981
* Change the date header to be the last-modified date of the blob. This means the CDN
8082
* will use the correct expiry time for the response. e.g. if the blob was last modified
@@ -101,7 +103,7 @@ export const adjustDateHeader = async (
101103
}
102104
const key = new URL(request.url).pathname
103105
const blobKey = await encodeBlobKey(key)
104-
const blobStore = getDeployStore()
106+
const blobStore = getDeployStore({ fetch: fetchBeforeNextPatchedIt })
105107

106108
// TODO: use metadata for this
107109
const { lastModified } = await tracer.startActiveSpan(

‎src/run/next.cts

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import type { getRequestHandlers } from 'next/dist/server/lib/start-server.js'
99

1010
type FS = typeof import('fs')
1111

12+
const fetchBeforeNextPatchedIt = globalThis.fetch
13+
1214
export async function getMockedRequestHandlers(...args: Parameters<typeof getRequestHandlers>) {
1315
const tracer = trace.getTracer('Next.js Runtime')
1416
return tracer.startActiveSpan('mocked request handler', async (span) => {
15-
const store = getDeployStore()
17+
const store = getDeployStore({ fetch: fetchBeforeNextPatchedIt })
1618
const ofs = { ...fs }
1719

1820
const { encodeBlobKey } = await import('../shared/blobkey.js')

0 commit comments

Comments
 (0)
Please sign in to comment.