diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 516b3a628c..66a5193518 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -28,7 +28,7 @@ jobs: with: deno-version: v1.x - name: Install netlify-cli and npm - run: npm install -g netlify-cli npm + run: npm install -g netlify-cli npm@10.2.4 - name: NPM Install run: npm install - name: Run integration tests diff --git a/packages/runtime/src/templates/handlerUtils.ts b/packages/runtime/src/templates/handlerUtils.ts index babcd0bf5d..fc7bf55e81 100644 --- a/packages/runtime/src/templates/handlerUtils.ts +++ b/packages/runtime/src/templates/handlerUtils.ts @@ -135,10 +135,12 @@ export const augmentFsModule = ({ // ...then monkey-patch it to see if it's requesting a CDN file promises.readFile = (async (file, options) => { - const baseUrl = getBase() - - // We only care about page files - if (file.startsWith(pageRoot)) { + // file argument can be a string, URL, etc - Next.js cache reading uses a string + // and that's only thing we really want to handle here, so we just do type checking + // instead of trying to handle all possible type before checking weather read + // is about page files. + if (typeof file === 'string' && file.startsWith(pageRoot)) { + const baseUrl = getBase() // We only want the part after `.next/server/` const filePath = file.slice(pageRoot.length + 1)