stack icon indicating copy to clipboard operation
stack copied to clipboard

TypeError in /handler/account-settings

Open jerebtw opened this issue 9 months ago • 10 comments

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

jerebtw avatar Mar 02 '25 21:03 jerebtw

Same error here stackframe/stack version 2.7.21

PolarBearEs avatar Mar 03 '25 02:03 PolarBearEs

Problem persists in 2.7.23

PolarBearEs avatar Mar 05 '25 18:03 PolarBearEs

Can you send me your package.json, or, ideally, a repo that reproduces this?

fomalhautb avatar Mar 18 '25 16:03 fomalhautb

hi @fomalhautb here is a repo that reproduces the error. Thank you for your help!

https://github.com/dubscode/stack-auth-issue

dubscode avatar Mar 31 '25 03:03 dubscode

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.

alpdeka avatar Apr 04 '25 18:04 alpdeka

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)

eriklumbela avatar Apr 07 '25 19:04 eriklumbela

Same error with version 2.8.3

vitoraguila avatar Apr 13 '25 23:04 vitoraguila

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

fomalhautb avatar May 14 '25 01:05 fomalhautb

You need to build the project (next build). In dev it does not error.

jerebtw avatar May 14 '25 08:05 jerebtw

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).

eriklumbela avatar Oct 03 '25 10:10 eriklumbela