TypeError: Cannot read properties of null (reading 'useContext')

Hey Guys, I'm experiencing an issue with my builds as of today.
TRPCClientError: Dynamic server usage: Route /dashboard/home couldn't be rendered statically because it used cookies. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
TRPCClientError: Dynamic server usage: Route /dashboard/home couldn't be rendered statically because it used cookies. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
I went through the issues on GH and even implemented the changes merged in[https://github.com/t3-oss/create-t3-app/pull/1741] but i still could not get the issue to go away. Some context: - The project is a Monorepo (T3-Turbo) - Almost all my TRPC routes use cookies - I have 2 TRPC providers per app (1 app specific, 1 shared) - The app is deployed on Azure App Service, not Vercel What i've tried: - Adding 'export foce-dynamic' --did not help - in RSC components adding 'unstable_noStore' -- did not help - applied changes from PR #1741 - did not help ANY help would be appreciated all the pages according to the build log that have dynamic usage
> Export encountered errors on following paths:
/(dashboard)/dashboard/(admin)/companies/page: /dashboard/companies
/(dashboard)/dashboard/(admin)/users/page: /dashboard/users
/(dashboard)/dashboard/(agent)/cargo-arrival/page: /dashboard/cargo-arrival
/(dashboard)/dashboard/(agent)/cargo-release/page: /dashboard/cargo-release
/(dashboard)/dashboard/(user)/documents/page: /dashboard/documents
/(dashboard)/dashboard/(user)/expected-arrivals/page: /dashboard/expected-arrivals
/(dashboard)/dashboard/(user)/shipment/page: /dashboard/shipment
/(dashboard)/dashboard/(user)/shipped-items/page: /dashboard/shipped-items
/(dashboard)/dashboard/(user)/tracking/page: /dashboard/tracking
/(dashboard)/dashboard/(user)/wr-overview/page: /dashboard/wr-overview
/(dashboard)/dashboard/home/page: /dashboard/home
/(dashboard)/dashboard/profile/page: /dashboard/profile
/_error: /404
/_error: /500
> Export encountered errors on following paths:
/(dashboard)/dashboard/(admin)/companies/page: /dashboard/companies
/(dashboard)/dashboard/(admin)/users/page: /dashboard/users
/(dashboard)/dashboard/(agent)/cargo-arrival/page: /dashboard/cargo-arrival
/(dashboard)/dashboard/(agent)/cargo-release/page: /dashboard/cargo-release
/(dashboard)/dashboard/(user)/documents/page: /dashboard/documents
/(dashboard)/dashboard/(user)/expected-arrivals/page: /dashboard/expected-arrivals
/(dashboard)/dashboard/(user)/shipment/page: /dashboard/shipment
/(dashboard)/dashboard/(user)/shipped-items/page: /dashboard/shipped-items
/(dashboard)/dashboard/(user)/tracking/page: /dashboard/tracking
/(dashboard)/dashboard/(user)/wr-overview/page: /dashboard/wr-overview
/(dashboard)/dashboard/home/page: /dashboard/home
/(dashboard)/dashboard/profile/page: /dashboard/profile
/_error: /404
/_error: /500
2 Replies
ZowtuPinda
ZowtuPinda6mo ago
Ok so, It seems like it the issue is not the dynamic server usage but:
TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (/home/vsts/work/1/s/apps/customer-web-portal/node_modules/react/cjs/react.production.min.js:24:495)
at h (/home/vsts/work/1/s/apps/customer-web-portal/.next/server/pages/_error.js:1:6021)
at Wc (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at $c (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at Zc (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)

Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (/home/vsts/work/1/s/apps/customer-web-portal/node_modules/react/cjs/react.production.min.js:24:495)
at h (/home/vsts/work/1/s/apps/customer-web-portal/.next/server/pages/_error.js:1:6021)
at Wc (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at bd (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
at Z (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
at $c (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
at Zc (/home/vsts/work/1/s/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)

Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
the issue is I don't have a 404 error file defined. I use the default built in one.
deforestor
deforestor4mo ago
Have you ever solved this? I've had this same problem for months and I'm reaching my limit lol
Want results from more Discord servers?
Add your server