TypeError: Cannot read properties of undefined (reading 'clientModules')
Answered
Thrianta posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
Hey, i am getting this error when deploying to vercel, locally everything works just as expected, when deployed to vercel in prod, i get this error and the page returns this error
Answered by Thrianta
This error was after all due to vercel and not nextjs itself, vercel was not able to find
client-manifest.json
and other stuff for that specific route apparently something with build, after building locally and uploading the build it works perfectly37 Replies
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
@Thrianta Have you tried to build your app locally? Can you provide the full error with the stack traces?
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
lemme try building locally, because on dev server it works fine
⨯ TypeError: Cannot read properties of undefined (reading 'clientModules')
at /var/task/node_modules/.pnpm/next@14.1.0_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:199008
at rW (/var/task/node_modules/.pnpm/next@14.1.0_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:14861)
at nM (/var/task/node_modules/.pnpm/next@14.1.0_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47419)
at nN (/var/task/node_modules/.pnpm/next@14.1.0_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
at nG (/var/task/node_modules/.pnpm/next@14.1.0_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:72265)
at AsyncLocalStorage.run (node:async_hooks:338:14)
at Timeout._onTimeout (/var/task/node_modules/.pnpm/next@14.1.0_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:88128)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
page: '/profile/835137181504372806'
}
This is the stack trace in vercel dashboard
i can't build locally but not because of this but another bug with vercel CLI
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
what? Can you run like
npm run build
?![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
yup
no error when building locally
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
Try to redeploy it, maybe.
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
build task passes, every other page also works fine, just this single page shows up with an error
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
Oh, can you provide the code for this page?
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
yup, gimme a sec
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
Why are you using
'use server'
here?I think removing it can fix the problem.
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
that is there to just make sure the database function is not exported to the client
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
To my knowledge, this code will only run on the server. I mean it's server-side rendering. It will not be exposed to the client side.
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
but having
'use server'
should not really change anything anywaysbesides, if that was the case why would it work locally
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
try upgrading nextjs version and redeploy without cache
i've seen scattered reports of this error which are fixed by updating versions and/or clearing
.next
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
i am on the latest version i think, ![:fine:](https://cdn.discordapp.com/emojis/753870958363803719.png)
14.1.0
![:fine:](https://cdn.discordapp.com/emojis/753870958363803719.png)
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
seems related to this https://github.com/vercel/next.js/pull/60776
oh it's not in stable yet, only in canary
try canary then. v14.1.1-canary.10
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
lemme try
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
still same error after updating nextjs version, trying after removing build cache
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
then im out of idea, sorry
it's working fine in my end
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
exactly, locally it is working perfectly fine
not working even after removing build cache
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
Do you set the env variables on vercel?
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
yup
![Avatar](https://cdn.discordapp.com/avatars/886269624608522240/318caaf5790b34fb479fb6373523b273.webp?size=256)
Hong
Then, I have no idea. ðŸ«
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
![:fine:](https://cdn.discordapp.com/emojis/753870958363803719.png)
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
for debug purposes i created a dummy api route where i was returning the user data to check if the database is causing this error, that route returned response just fine so that is not causing this error either
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
ThriantaOP
This error was after all due to vercel and not nextjs itself, vercel was not able to find
client-manifest.json
and other stuff for that specific route apparently something with build, after building locally and uploading the build it works perfectlyAnswer
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
Ant
I resolved this issue by removing my Route Groups, that's folders that look like this '(folderName)' - these guys: https://nextjs.org/docs/app/building-your-application/routing/route-groups