You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the lastest nextjs version, redirect from a server action cause an error due to cookie state.
Cookie state json encoding seems to be broken at some point.
Stack trace:
⨯ SyntaxError: Unexpected token '%', "%7B%22stat"... is not valid JSON
at JSON.parse ()
at RootLayout (./src/app/layout.tsx:29:85)
at stringify ()
at AsyncLocalStorage.run (node:async_hooks:346:14)
Link to minimal reproducible example
https://wagmi-redirect-error-nextjs-production.up.railway.app/
Summary
With the lastest nextjs version, redirect from a server action cause an error due to cookie state.
Cookie state json encoding seems to be broken at some point.
Source repo :
https://github.com/jpcrinon/wagmi-redirect-error-nextjs
Stack trace:
⨯ SyntaxError: Unexpected token '%', "%7B%22stat"... is not valid JSON
at JSON.parse ()
at RootLayout (./src/app/layout.tsx:29:85)
at stringify ()
at AsyncLocalStorage.run (node:async_hooks:346:14)
List of related npm package versions
"dependencies": {
"@tanstack/react-query": "^5.32.0",
"@web3modal/wagmi": "^4.1.11",
"next": "^14.2.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"viem": "^2.9.28",
"wagmi": "^2.7.0"
},
"devDependencies": {
"@types/node": "20.11.5",
"@types/react": "18.3.1",
"eslint": "8.56.0",
"eslint-config-next": "14.1.0",
"typescript": "5.3.3"
}
The text was updated successfully, but these errors were encountered: