All nextjs builds returning 500 error with TypeError: file.startsWith is not a function

My site builds fine (, but since this afternoon, all builds give a 500 internal server error.

The error on the SSR function looks like this:

Dec 1, 09:38:18 PM: 14e18314 ERROR  TypeError: file.startsWith is not a function
Dec 1, 09:38:18 PM: 14e18314 ERROR      at promises.readFile (/var/task/apps/browse/.netlify/functions-internal/___netlify-handler/handlerUtils.js:112:18)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at getSource (node:internal/modules/esm/load:44:20)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at defaultLoad (node:internal/modules/esm/load:130:38)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at ModuleLoader.load (node:internal/modules/esm/loader:396:13)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at new ModuleJob (node:internal/modules/esm/module_job:65:26)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at #createModuleJob (node:internal/modules/esm/loader:290:17)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:248:34)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:229:17)
Dec 1, 09:38:18 PM: 14e18314 ERROR      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I’ve tried rebuilding different branches that worked previously and they now also fail in the same way.

Build is part of a monorepo, other apps within the monorepo on other sites are building fine.

Build settings:

command = "pnpm exec nx build browse"
publish = "dist/apps/browse/.next"

This seems to be the source

I have created an entirely new site, and the same thing is happening on there too (from the same repo, but using branches that worked fine this morning, they failed too)

I have also tried deploying a commit from a week ago that worked for sure. Same errors.

1 Like

This morning I have tried pinning to an old version of @netlify/plugin-nextjs but makes no difference. This is pretty concerning as we’re due to launch this next week :grimacing:

I am experiencing the exact same error as well. One deploy was perfectly fine, and the next inexplicably had this error. I reverted many packages to lower versions to no avail. I even rebuilt the last successfully built git commit, but this same commit is now showing the file.startsWith runtime error.

I’m becoming more and more convinced it’s some sort of internal error. Following, this is urgent.

I have a feeling the bundled function zip is too large, so it’s missing some dependencies when it’s extracted. Investigating now

I’m also running into this problem. Switching the pages on my site to Next.js SSG resolved the page issues, but my pages/api endpoint is still experiencing the problem and that can’t be made SSG.

@pixelbreaker, you seem to be using Node.js 20: Deploy details | Deploys | playful-strudel-d5e9b7 | Netlify, mind trying to downgrade to Node.js 18?

For others, we need to see the site to check.

Downgrading to Node.js 18 fixed it for me… Thanks for the help.

Downgrading to Node 18 fixed it for me too. Thank you for the help!

Downgrading to Node 18 also fixed it for me, thanks @hrishikesh

I’m having a similar same issue with Node 18 still. Except its happening in Function Next.js ISR handler instead of at build time :thinking:

I recently updated a page on my NextJS app and changed nothing except some copy. It was working fine before and started failing after deploy

Dec 5, 10:33:53 PM: 3b897bda ERROR  TypeError: file.startsWith is not a function
    at promises.readFile (/var/task/.netlify/functions-internal/___netlify-odb-handler/handlerUtils.js:112:18)
    at getSource (node:internal/modules/esm/load:44:20)
    at defaultLoad (node:internal/modules/esm/load:130:38)
    at ModuleLoader.load (node:internal/modules/esm/loader:396:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56)
    at new ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:290:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:248:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:229:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

update 2023-12-06

I tried deploying the same site on Vercel and it worked there

@jaminhaber, I can say for certain, if you’re running into this issue, you’d using Node 20. You might not realise it, but there’s a high chance you’re. If you let us know the site name, we can double check.

This is also fixed in 4.41.3 of Next.js Runtime: Release plugin-nextjs: v4.41.3 · netlify/next-runtime ( So folks can use Node.js 20. Most users should be auto-updated by the end of next week, but if someone wants to check it out now, they can manually install: netlify/next-runtime: The Next.js Runtime allows Next.js to run on Netlify with zero configuration (

1 Like

Hi, we’re getting this on Node 18.x. Could you please advise @hrishikesh

It’s unlikely you’re seeing this on Node 18. It strictly happens on Node 20. Feel free to share a site name.

I’m seeing this on node 14, 18 and 20 as of this morning. No issues previously on my node 14 site.

1 Like

We also started to get the same error today in our project

1 Like

I had left another comment here before but it seems to be missing. Upgrading @netlify/plugin-nextjs fixed the issue for us. For anyone facing the same issue please try this.

My question is how can it be that webhooks are broken suddenly, and how can we be sure that this won’t happen again in future. Thanks

Upgrading @netlify/plugin-nextjs seemingly fixed the issue for us as well, but now we’re running into a ‘Page not found’ error that we have not seen before for the same pages that earlier showed the error from this thread

I stand corrected, this indeed seems to be breaking with Node 18 as well now. Not sute if Node 14 would also cause this because Node 14 cannot be used in Functions anymore as far as I know.

But yes, updating to 4.41.3 Next.js Runtime should fix it.

But then I get this error

When is Next.js Runtime 4.41.3 going to be fixed?