TypeError in /handler/account-settings
When i build my nextjs project and go to the account settings i get the following error:
Uncaught TypeError: n.useRouter is not a function
at e.useNavigate (stack-app.js:947:1)
at bZ (sidebar-layout.tsx:27:24)
at lS (react-dom-client.production.js:3208:1)
at ot (react-dom-client.production.js:5850:1)
at ov (react-dom-client.production.js:6846:1)
at ic (react-dom-client.production.js:10856:1)
at react-dom-client.production.js:10737:35
at is (react-dom-client.production.js:10738:1)
at u9 (react-dom-client.production.js:10323:1)
at ij (react-dom-client.production.js:11627:1)
at MessagePort.M (scheduler.production.js:151:1)
next.config.ts
productionBrowserSourceMaps: true
Same error here
stackframe/stack version 2.7.21
Problem persists in 2.7.23
Can you send me your package.json, or, ideally, a repo that reproduces this?
hi @fomalhautb here is a repo that reproduces the error. Thank you for your help!
https://github.com/dubscode/stack-auth-issue
I have the same problem. Can I get information about the solution?
Update:
Starting from version 2.7.20, when we compile with npm run build and npm start, the handler/account-settings route in next.js gets the error "Uncaught TypeError: n.useRouter is not a function". Therefore, I can use version 2.7.19 in next.js, but I cannot use later versions. I would be glad if you could look into the relevant error. I would like to be able to use the most up-to-date version.
I have the same problem. I also reverted to version 2.7.19.
This error only occurs when running production builds (next build > next start), not when deployed in dev mode (next dev)
Same error with version 2.8.3
hi @fomalhautb here is a repo that reproduces the error. Thank you for your help!
https://github.com/dubscode/stack-auth-issue
This example seems to work for me. I cloned it, added my env vars, pnpm i, pnpm dev; then it works fine. Signing in and going to the account settings page doesn't trigger any errors
You need to build the project (next build). In dev it does not error.
I tested again after upgrading to latest version and as far as i can see I think the issue has been resolved (in both dev and prod builds).