Search code examples
next.jsnext-auth

NextJs with NextAuth Problem with cookies / itarable problem


I am currently facing a problem, maybe you can help me. I always get the following error:

- event compiled client and server successfully in 307 ms (168 modules)
- event compiled client and server successfully (447 modules)
- warn Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
TypeError: cookies is not iterable
    at get [headers map sorted] (node:internal/deps/undici/undici:1844:34)
    at node:internal/deps/undici/undici:1865:43
    at Headers Iterator.next (node:internal/deps/undici/undici:1108:26)
    at toNodeOutgoingHttpHeaders (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/web/utils.js:106:31)
    at invokeRender (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/lib/router-server.js:250:122)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleRequest (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/lib/router-server.js:422:24)
    at async requestHandler (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/lib/router-server.js:439:13)
TypeError: cookies is not iterable
    at get [headers map sorted] (node:internal/deps/undici/undici:1844:34)
    at node:internal/deps/undici/undici:1865:43
    at Headers Iterator.next (node:internal/deps/undici/undici:1108:26)
    at toNodeOutgoingHttpHeaders (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/web/utils.js:106:31)
    at invokeRender (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/lib/router-server.js:250:122)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleRequest (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/lib/router-server.js:422:24)
    at async requestHandler (/Users/123/Talentstark/talentstark/node_modules/next/dist/server/lib/router-server.js:439:13)

With:

  "dependencies": {
    "@emotion/react": "^11.11.1",
    "@emotion/styled": "^11.11.0",
    "@headlessui/react": "^1.7.16",
    "@heroicons/react": "^2.0.18",
    "@mui/material": "^5.14.3",
    "@prisma/client": "^5.1.1",
    "@types/node": "20.4.8",
    "@types/react": "18.2.18",
    "@types/react-dom": "18.2.7",
    "autoprefixer": "10.4.14",
    "eslint": "8.46.0",
    "eslint-config-next": "13.4.13",
    "next": "13.4.13",
    "next-auth": "^4.22.1",
    "postcss": "8.4.27",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "tailwindcss": "3.3.3",
    "typescript": "5.1.6"
  },
  "devDependencies": {
    "prisma": "^5.1.1"
  }

Otherwise, the structure should be as in /api/auth/[...nextauth]/route.ts

and also in the route.ts the standard for github auth.

Thank you in advance for your help!


Solution

  • Problem solved - downgrading nodeJs version to 18.17