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
teaonrocks2y ago
bump
jdsl
jdsl2y 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 Perkins2y 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
teaonrocks2y ago
this is how i conditionally render my sidebar is there a better way to do this?
teaonrocks
teaonrocks2y ago
i changed it to pages/sign-in/index.tsx is that right?
teaonrocks
teaonrocks2y ago
any idea why im getting these errors in my console?
jdsl
jdsl2y ago
This should be pages/sign-in/[[...index]].tsx as a catch-all route.
teaonrocks
teaonrocks2y ago
oh okay
jdsl
jdsl2y 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
teaonrocks2y 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
Zero2y 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
teaonrocks2y ago
thanks for pointing that out but its still returning 404s
tropic
tropic2y 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
teaonrocks2y ago
nope im using mysql in planetscale
sheng2808
sheng28082y ago
did you set up your development properly? like your .env things on vercel?
teaonrocks
teaonrocks2y 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
Diogo17mo ago
Solved by removing i18n on next.config.mjs
tropic
tropic17mo 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
Diogo17mo ago
It was already 1 AM where I live, I was losing sanity while trying to solve it
Want results from more Discord servers?
Add your server