-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read properties of null (reading 'entries')
#56
Comments
Closing as it's fixed in |
This does not appear to be fixed. I am still getting this in |
@jmsherry Are you using it in pages router? If yes could you try commenting it there and leaving it in app router and run a build? |
I am getting this error now. Using pages router, with these versions: |
I think it's safe to assume this happens when used with /pages. |
I fixed the problem by deleting the .next folders and rebuilding |
I still have this error even after deleting the .next folders and rebuilding them. I tried adding a webpack module alias, but the alias only takes effect on the client side, causing a re-hydration error. |
Just added this to my application and am getting the same issue when running in test environment. Originally, I saw an error complaining about no next_auth secret, so I added that, but the error persists. Possibly another env variable that isn't present? Or a bad check based on NODE_ENV? Local build works fine, preview deploy in vercel works fine.
From digging in the built code, the error stems from this line: const searchParams = useSearchParams();
...
const finalParams = {
...Object.fromEntries(searchParams.entries()), // <--
...params || {}
}; Which comes from next/dist/client/components/navigation.js > useSearchParams: const readonlySearchParams = (0, _react.useMemo)(()=>{
if (!searchParams) {
// When the router is not ready in pages, we won't have the search params
// available.
return null;
}
return new ReadonlyURLSearchParams(searchParams);
}, [
searchParams
]); There is a possibility searchParams is null which would lead to the call here snapping. No idea why it's only happening when I change NODE_ENV to test. As this library appears to handle that already: function detectEnvironment() {
try {
const env = process.env.NODE_ENV;
if (env === "development" || env === "test") {
return "development";
}
} catch (e) {
}
return "production";
} |
I was encountering this error because I added the component to _documents.tsx instead of _app.tsx. When I updated it to _app.tsx, I did not get any errors. Make sure to add _app.tsx. |
I have the components added in
Currently I have them conditionally rendered with the equivalent of |
In my Next.js 14.1 project I get the following error log in the server console on every build/dev run:
<SpeedInsights />
is used inside<body>
in both/pages/_document.tsx
and/app/layout.tsx
. The error doesn't stop the build process. Happens both in@latest
and@canary
.The text was updated successfully, but these errors were encountered: