Unexpected token < in JSON at position 0 #6487
Replies: 5 comments 5 replies
-
We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate. Why was this issue marked with the
|
Beta Was this translation helpful? Give feedback.
-
If you use Sentry, I got this same error today caused by newer versions of Though according to the docs the most common cause for this error is not having |
Beta Was this translation helpful? Give feedback.
-
@kriscarle |
Beta Was this translation helpful? Give feedback.
-
In my case, I had this matcher value in the config var of the middleware file: |
Beta Was this translation helpful? Give feedback.
-
This was actually my problem, when putting the path My middleware looked like this after removing
|
Beta Was this translation helpful? Give feedback.
-
Environment
System:
OS: macOS 11.6.6
CPU: (16) x64 Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz
Memory: 368.77 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 18.12.0 - ~/.nodebrew/current/bin/node
Yarn: 1.22.0 - ~/transcope/node_modules/.bin/yarn
npm: 8.19.2 - ~/.nodebrew/current/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 109.0.5414.87
Firefox: 105.0.2
Safari: 14.1.2
npmPackages:
next: 13.1.1 => 13.1.1
next-auth: 4 => 4.18.8
react: 18.2.0 => 18.2.0
Reproduction URL
http://localhost:3000/api/auth/session
Describe the issue
[next-auth][error][CLIENT_FETCH_ERROR]
https://next-auth.js.org/errors#client_fetch_error Unexpected token < in JSON at position 0 {
error: {
message: 'Unexpected token < in JSON at position 0',
stack: 'SyntaxError: Unexpected token < in JSON at position 0\n' +
' at JSON.parse ()\n' +
' at Response.json (node:internal/deps/undici/undici:6160:23)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
name: 'SyntaxError'
},
url: 'http://localhost:3000/api/auth/session',
message: 'Unexpected token < in JSON at position 0'
}
How to reproduce
access http://localhost:3000/api/auth/session
Expected behavior
The error won't occur
Beta Was this translation helpful? Give feedback.
All reactions