next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

@auth/[email protected] onclick signIn/signOut causes SyntaxError: Unexpected token '<'

Open vkarisari opened this issue 9 months ago • 7 comments

Environment

  System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 Intel(R) Xeon(R) E-2176G CPU @ 3.70GHz
    Memory: 12.86 GB / 31.86 GB
  Binaries:
    Node: 22.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.1.1 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Chrome: 134.0.6998.89
    Edge: Chromium (133.0.3065.92)
    Internet Explorer: 11.0.26100.1882```


### Reproduction URL

https://github.com/vkarisari/svauth180-bug

### Describe the issue

I have a signin/signout button that throws SyntaxError: Unexpected token '<' when clicking. The buttons calls signOut/signIn from @auth/sveltekit/client. This is on version 1.8.0. I downgraded to 1.7.4 and it worked just fine.

### How to reproduce

Check the github repo, or go to https://svauth180-bug.vercel.app/ and blick the buttons.

### Expected behavior

Redirect to login/logout page.

vkarisari avatar Mar 14 '25 08:03 vkarisari

The issue might be related to the library POSTing to /signin/{provider} instead of /auth/signin/{provider} as it did before.

tijptjik avatar Mar 17 '25 08:03 tijptjik

Same here, why change the api, 1.7.4 works fine.

Find the pull request at: https://github.com/nextauthjs/next-auth/pull/12249

Maybe we should rollback to 1.7.4

xcaptain avatar Mar 18 '25 02:03 xcaptain

Same issue here. Rolling back to 1.7.4.

This change doesn't seem to be documented in the release.

magnuslundin avatar Mar 24 '25 08:03 magnuslundin

Any updates on this issue ? Does there come a patch version for the 1.8.0 ?

p-arndt avatar Mar 29 '25 16:03 p-arndt

https://github.com/nextauthjs/next-auth/blob/ca30e90eb403d174d3398f79c8eba5217fe15db6/packages/frameworks-sveltekit/src/lib/client.ts#L89 now goes to {base}/signin instead of {base}/auth/signin . Not sure if intentional but the server side handler expects auth in the prefix.

Any input on this @balazsorban44 ? It was changed in this commit: https://github.com/nextauthjs/next-auth/commit/1c9bcdd0c4538a852f8d2b2b7c60eb962e3a50eb

vandmo avatar Apr 03 '25 07:04 vandmo

Any updates on this issue ? Does there come a patch version for the 1.8.0 ?

Confirmed that it is not fixed as of 1.9.0

tijptjik avatar Apr 23 '25 02:04 tijptjik

Confirmed that it is not fixed in 1.9.1.

thebjorn avatar Apr 28 '25 13:04 thebjorn