Error in nextjs while making build #138358
-
Select Topic AreaQuestion Body |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The error you're encountering is primarily due to using Firebase's Remote Config in a server environment, where the window object isn't available. Firebase Remote Config is meant to be used on the client side, as it's dependent on browser-specific objects like window. Steps to Fix: Handling Errors in Next.js Exports: The pages like /, _not-found, and /privacypolicy seem to be encountering errors. Ensure that the code in these pages is also only running Firebase Remote Config on the client side, or adjust these pages to avoid dependencies that require the window object during the build process. By doing these, you will prevent the Remote Config error from affecting your server-side rendering and static generation. |
Beta Was this translation helpful? Give feedback.
The error you're encountering is primarily due to using Firebase's Remote Config in a server environment, where the window object isn't available. Firebase Remote Config is meant to be used on the client side, as it's dependent on browser-specific objects like window.
Steps to Fix:
Ensure Remote Config Runs Only on the Client-Side: You need to wrap your Firebase Remote Config logic inside a useEffect hook or conditionally check for the existence of window to ensure it's only executed in the client environment.
Resolve Prerendering Errors for Static Pages: Since Next.js is attempting to prerender pages like /, _not-found, and /privacypolicy, and these pages are failing due to the same wind…