Build failing and runtime error

Site ID: 398a4554-26f5-4ff3-83c0-39d60523cb88

The site has started failing and says the function has crashed but the only error has come from the Netlify side, and a package that I’m not using in the code at all. Building and running locally doesn’t have the same issue.

Jul 4, 07:19:32 PM: 2024-07-04T11:19:32.549Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Cannot find package 'urlpattern-polyfill' imported from /var/task/___netlify-bootstrap.mjs","code":"ERR_MODULE_NOT_FOUND","stack":["Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'urlpattern-polyfill' imported from /var/task/___netlify-bootstrap.mjs","    at packageResolve (node:internal/modules/esm/resolve:858:9)","    at moduleResolve (node:internal/modules/esm/resolve:931:18)","    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1161:14)","    at defaultResolve (node:internal/modules/esm/resolve:1204:79)","    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)","    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)","    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)","    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)","    at link (node:internal/modules/esm/module_job:86:36)"]}Jul 4, 07:19:32 PM: INIT_REPORT Init Duration: 321.76 ms	Phase: invoke	Status: error	Error Type: Runtime.UnknownJul 4, 07:19:32 PM: Unknown application error occurred
Runtime.UnknownJul 4, 07:19:32 PM: 60551d2b Duration: 479.06 ms	Memory Usage: 23 MB	Jul 4, 07:19:33 PM: 2024-07-04T11:19:33.384Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Cannot find package 'urlpattern-polyfill' imported from /var/task/___netlify-bootstrap.mjs","code":"ERR_MODULE_NOT_FOUND","stack":["Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'urlpattern-polyfill' imported from /var/task/___netlify-bootstrap.mjs","    at packageResolve (node:internal/modules/esm/resolve:858:9)","    at moduleResolve (node:internal/modules/esm/resolve:931:18)","    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1161:14)","    at defaultResolve (node:internal/modules/esm/resolve:1204:79)","    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)","    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)","    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)","    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)","    at link (node:internal/modules/esm/module_job:86:36)"]}Jul 4, 07:19:33 PM: INIT_REPORT Init Duration: 324.44 ms	Phase: invoke	Status: error	Error Type: Runtime.UnknownJul 4, 07:19:33 PM: Unknown application error occurred
Runtime.UnknownJul 4, 07:19:33 PM: 306eab6e Duration: 492.32 ms	Memory Usage: 24 MB

While trying to debug it, now the site won’t build on Netlify at all, it’s saying it can’t find files that haven’t been changed, still exist exactly where they were and again the build works fine when running the build locally.

 Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
7:19:39 PM: Failed to compile.
7:19:39 PM: 
7:19:39 PM: ./src/app/[[...sign-in]]/page.tsx
7:19:39 PM: Module not found: Can't resolve '@components/fetchData/guest'
7:19:39 PM: https://nextjs.org/docs/messages/module-not-found
7:19:39 PM: ./src/app/layout.tsx
7:19:39 PM: Module not found: Can't resolve '@components/header'
7:19:39 PM: https://nextjs.org/docs/messages/module-not-found
7:19:39 PM: ./src/app/layout.tsx
7:19:39 PM: Module not found: Can't resolve '@components/footer'
7:19:39 PM: https://nextjs.org/docs/messages/module-not-found
7:19:39 PM: ./src/app/layout.tsx
7:19:39 PM: Module not found: Can't resolve '@components/fathom'
7:19:39 PM: https://nextjs.org/docs/messages/module-not-found
7:19:39 PM: ./src/app/layout.tsx
7:19:39 PM: Module not found: Can't resolve '@styles/app.css'
7:19:39 PM: https://nextjs.org/docs/messages/module-not-found
7:19:39 PM: > Build failed because of webpack errors

When I try and build/serve it locally using the Netlify CLI and that fails as well, it says it’s missing env variables despite them being set in the Netlify UI

Same to me, actrually the dependency chain is:

@netlify/zip-it-and-ship-it
    - @netlify/serverless-functions-api
        - @netlify/node-cookies
        - urlpattern-polyfill

So it’s an internal error of Netlify obviously.

Netlify Status - Incorrect function deployments affecting some Starter accounts