Open Krasnopir opened 1 month ago
I have suddenly the same error. There were no changes made and this error happens when deploying the application. Build locally works fine, vercel deploy throws this error.
TypeError: Cannot read properties of null (reading 'auth')
--
16:38:14.053 | at a (/vercel/path0/.next/server/chunks/625.js:6:215122)
16:38:14.053 | at O (/vercel/path0/.next/server/chunks/625.js:6:174074)
16:38:14.053 | at /vercel/path0/.next/server/chunks/625.js:6:175009
16:38:14.053 | at Object.nr [as useMemo] (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:39088)
16:38:14.053 | at t.useMemo (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:106635)
16:38:14.053 | at /vercel/path0/.next/server/chunks/625.js:6:174977
16:38:14.053 | at nP (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58441)
16:38:14.053 | at n$ (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61978)
16:38:14.053 | at nE (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:44877)
16:38:14.053 | at nP (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58448)
16:38:14.105 |
16:38:14.105 | Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
16:38:14.105 | TypeError: Cannot read properties of null (reading 'auth')
16:38:14.105 | at a (/vercel/path0/.next/server/chunks/625.js:6:215122)
16:38:14.105 | at O (/vercel/path0/.next/server/chunks/625.js:6:174074)
16:38:14.105 | at /vercel/path0/.next/server/chunks/625.js:6:175009
16:38:14.106 | at Object.nr [as useMemo] (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:39088)
16:38:14.106 | at t.useMemo (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:106635)
16:38:14.106 | at /vercel/path0/.next/server/chunks/625.js:6:174977
16:38:14.106 | at nP (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58441)
16:38:14.106 | at n$ (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61978)
16:38:14.109 | at nE (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:44877)
16:38:14.109 | at nP (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:58448)
16:38:14.536 | Generating static pages (11/44)
16:38:18.106 | Generating static pages (22/44)
16:38:20.328 | Generating static pages (33/44)
16:38:21.301 | ✓ Generating static pages (44/44)
16:38:21.311 |
16:38:21.313 | > Export encountered errors on following paths:
16:38:21.313 | /_not-found
I went spelunking in the code, and this looks suspicious to me:
This non-null assertion means clientReferenceManifest
could actually be null
or undefined
and TypeScript won't check it. If it's undefined
, you'll get the TypeError: Cannot read properties of undefined (reading 'clientModules')
on, say, line 946:
My guess is that this issue was introduced here: https://github.com/vercel/next.js/pull/64313
But I definitely don't have enough knowledge or context to confirm that or offer a suggestion on how to fix this
Another thing I found — after running a build, looking at the .next/app-paths-manifest.json
file, I see an entry for "/_not-found/page": "app/_not-found/page.js"
. I also noticed that for every other entry in there, there is a corresponding <bundlename>-client-reference-manifest.js
, but this file is missing for the not-found page.
# notice that a file shows up for every page entry
# but is missing for the not-found page
find .next/ -path '*client-reference-manifest.js'
I'm guessing that this missing file corresponds to an undefined clientReferenceManifest
I mentioned in my last comment.
When I downgrade to v14.1.4, I see a couple of differences:
.next/server/app/_not-found.js
(instead of .next/server/app/_not-found/page.js
in v14.2.3).next/server/app/_not-found_client-reference-manifest.js
existsI now think this bug was caused by https://github.com/vercel/next.js/pull/62679
Maybe this if
statement evaluates to false
when using page extensions?
Here's a minimal reproduction https://github.com/awmottaz/next-typeerror-not-found
I have the same issue, builds fine locally but on Vercel I get this error:
[20:37:58.035] Running build in Washington, D.C., USA (East) – iad1
[20:37:59.058] Cloning github.com/riccardolardi/maybeparis-next (Branch: main, Commit: 2875c34)
[20:37:59.894] Cloning completed: 835.705ms
[20:38:04.646] Restored build cache
[20:38:04.883] Running "vercel build"
[20:38:05.934] Vercel CLI 34.1.10
[20:38:06.673] Installing dependencies...
[20:38:07.448] yarn install v1.22.19
[20:38:07.646] [1/4] Resolving packages...
[20:38:08.138] [2/4] Fetching packages...
[20:38:08.146] warning Pattern ["strip-ansi-cjs@npm:strip-ansi@^6.0.1"] is trying to unpack in the same destination "/vercel/.cache/yarn/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi@^6.0.1"]. This could result in non-deterministic behavior, skipping.
[20:38:08.146] warning Pattern ["string-width@^4.1.0"] is trying to unpack in the same destination "/vercel/.cache/yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width-cjs@npm:string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
[20:38:08.146] warning Pattern ["strip-ansi@^6.0.0"] is trying to unpack in the same destination "/vercel/.cache/yarn/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi@^6.0.1"]. This could result in non-deterministic behavior, skipping.
[20:38:32.651] [3/4] Linking dependencies...
[20:38:32.652] warning " > urql@4.1.0" has unmet peer dependency "@urql/core@^5.0.0".
[20:38:37.594] [4/4] Building fresh packages...
[20:38:37.611] Done in 30.17s.
[20:38:37.660] Detected Next.js version: 14.2.3
[20:38:37.662] Running "yarn run build"
[20:38:37.869] yarn run v1.22.19
[20:38:37.892] $ next build
[20:38:38.676] ▲ Next.js 14.2.3
[20:38:38.676]
[20:38:38.751] Creating an optimized production build ...
[20:38:52.305] ✓ Compiled successfully
[20:38:52.306] Linting and checking validity of types ...
[20:38:59.325] Collecting page data ...
[20:38:59.842] TypeError [ERR_INVALID_URL]: Invalid URL
[20:38:59.842] at new NodeError (node:internal/errors:405:5)
[20:38:59.842] at new URL (node:internal/url:676:13)
[20:38:59.843] at 6192 (/vercel/path0/.next/server/app/_not-found/page.js:1:4320)
[20:38:59.843] at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)
[20:38:59.843] at 338 (/vercel/path0/.next/server/app/_not-found/page.js:1:954)
[20:38:59.843] at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)
[20:38:59.844] at n (/vercel/path0/.next/server/app/_not-found/page.js:43:75)
[20:38:59.848] at /vercel/path0/.next/server/app/_not-found/page.js:43:106
[20:38:59.848] at t.X (/vercel/path0/.next/server/webpack-runtime.js:1:1206)
[20:38:59.848] at /vercel/path0/.next/server/app/_not-found/page.js:43:88 {
[20:38:59.848] input: 'undefined',
[20:38:59.848] code: 'ERR_INVALID_URL'
[20:38:59.849] }
[20:38:59.849]
[20:38:59.849] > Build error occurred
[20:38:59.849] Error: Failed to collect page data for /_not-found
[20:38:59.849] at /vercel/path0/node_modules/next/dist/build/utils.js:1268:15
[20:38:59.849] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[20:38:59.849] type: 'Error'
[20:38:59.849] }
[20:38:59.887] error Command failed with exit code 1.
[20:38:59.888] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[20:38:59.927] Error: Command "yarn run build" exited with 1
[20:39:00.377]
Since today the build suddenly succeeds... must've been something related to Vercel?
Since today the build suddenly succeeds... must've been something related to Vercel?
Not Vercel. I'm struggling with local builds and our AWS server is spitting out the same error too
Another thing I found — after running a build, looking at the
.next/app-paths-manifest.json
file, I see an entry for"/_not-found/page": "app/_not-found/page.js"
. I also noticed that for every other entry in there, there is a corresponding<bundlename>-client-reference-manifest.js
, but this file is missing for the not-found page.# notice that a file shows up for every page entry # but is missing for the not-found page find .next/ -path '*client-reference-manifest.js'
I'm guessing that this missing file corresponds to an undefined
clientReferenceManifest
I mentioned in my last comment.When I downgrade to v14.1.4, I see a couple of differences:
* The not-found page is built to `.next/server/app/_not-found.js` (instead of `.next/server/app/_not-found/page.js` in v14.2.3) * The file `.next/server/app/_not-found_client-reference-manifest.js` exists
I now think this bug was caused by #62679
Downgraded to 14.1.4 from my package.json, and I can confirm I no longer see the following error:
> Export encountered errors on following paths:
/_not-found/page: /_not-found
experiencing same issue after upgrade to 15-rc
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/misty-glade-yh92cc
To Reproduce
After update to 14.2.* version, when i use
pageExtensions
innext.config
, i got an error while try to build my appi have in my
app
folder all files with.page.tsx
-Current vs. Expected behavior
Build app fail with
pageExtentions
optionProvide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response