getting 404 in production but works locally

GitHub
GitHub - bentoodev/crm-grow
Contribute to bentoodev/crm-grow development by creating an account on GitHub.
19 Replies
teaonrocks
teaonrocks14mo ago
bump
jdsl
jdsl14mo ago
Just looking at the console error from https://crm-grow.vercel.app:
There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.
There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.
I see your sidebar pop in and out before the error happens. Try removing it to see if the error is in there. Also don't have your components folder inside your pages folder. Only pages and api routes should exists there. Also check line 12 in /pages/sign-in.tsx:
if (isLoaded && isSignedIn) {
const timer = setInterval(() => {
if (count > 0) {
setCount(count - 1);
}
if (count == 0) {
clearInterval(timer);
void signOut();
}
}, 1000);
}
if (isLoaded && isSignedIn) {
const timer = setInterval(() => {
if (count > 0) {
setCount(count - 1);
}
if (count == 0) {
clearInterval(timer);
void signOut();
}
}, 1000);
}
This should probably be wrapped in useEffect and only happen on client
James Perkins
James Perkins14mo ago
Also your sign-in page should be sign-in/[[...index]].tsx if you are using Clerk as we need to be able to handle the redirect portion which /sign-in doesn't
teaonrocks
teaonrocks14mo ago
this is how i conditionally render my sidebar is there a better way to do this?
teaonrocks
teaonrocks14mo ago
i changed it to pages/sign-in/index.tsx is that right?
teaonrocks
teaonrocks14mo ago
any idea why im getting these errors in my console?
jdsl
jdsl14mo ago
This should be pages/sign-in/[[...index]].tsx as a catch-all route.
teaonrocks
teaonrocks14mo ago
oh okay
jdsl
jdsl14mo ago
More info on catch-all routes if you haven't run into them before: https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes
teaonrocks
teaonrocks14mo ago
hey @joerambo I still cant solve the issue any more ideas? i feel that theres a problem with _app.tsx but im not sure is conditionally rendering in _app.tsx okay?
Zero
Zero14mo ago
I haven't really looked that deep but you named your file in here: https://github.com/bentoodev/crm-grow/tree/main/src/pages/sign-in [[...index]].tsx.tsx
GitHub
crm-grow/src/pages/sign-in at main · bentoodev/crm-grow
Contribute to bentoodev/crm-grow development by creating an account on GitHub.
teaonrocks
teaonrocks14mo ago
thanks for pointing that out but its still returning 404s
jordanmckoy
jordanmckoy14mo ago
Are you using sqlite db ? I just had this issue and I switched to using railway for my database and it worked for me let me know if that works
teaonrocks
teaonrocks14mo ago
nope im using mysql in planetscale
sheng2808
sheng280814mo ago
did you set up your development properly? like your .env things on vercel?
teaonrocks
teaonrocks14mo ago
yes i removed the conditional logic in _app.tsx that stopped the hydration error but still getting the 404 on sign-in fixed: skipMiddlewareUrlNormalise: false ( in nexjs.config )
Diogo
Diogo12mo ago
Solved by removing i18n on next.config.mjs
jordanmckoy
jordanmckoy12mo ago
YOu are one of the reasons I have faith in humanity, You found a similar post and posted a suggestion a true hero man My biggest pet peve is when people say nvm solved it and just leave =/
Diogo
Diogo12mo ago
It was already 1 AM where I live, I was losing sanity while trying to solve it