Next.js Discord

Discord Forum

Vercel build error document reference not found.

Unanswered
Filipino Venus posted this in #help-forum
Open in Discord
Filipino VenusOP
ReferenceError: document is not defined
at createTag (/vercel/path0/.next/server/chunks/85.js:1:9458)
at /vercel/path0/.next/server/chunks/85.js:1:22346
at /vercel/path0/.next/server/chunks/85.js:1:22469
at /vercel/path0/.next/server/chunks/85.js:1:25294
at /vercel/path0/.next/server/chunks/85.js:1:9123
at 8187 (/vercel/path0/.next/server/chunks/85.js:1:9127)
at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)
at 569 (/vercel/path0/.next/server/chunks/85.js:1:100)
at t (/vercel/path0/.next/server/webpack-runtime.js:1:128)
at 5675 (/vercel/path0/.next/server/chunks/242.js:1:11449)

2 Replies

Asian black bear
Highlander
I faced a similar issue while integrating Firebase during the build process. When I added a file in the public directory, I encountered the error: ReferenceError: navigator is not defined.

I had created the Firebase configuration in the root of the project, where the middleware.ts file is located, and everything was running fine. However, this error occurred during the build because something client-side was being accessed at build time, which is unavailable in that environment.
https://stackoverflow.com/a/77914603