Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next: app /api-example: TypeError: Cannot read property 'getToken' of undefined #2594

Closed
bbigras opened this issue Aug 24, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@bbigras
Copy link
Contributor

bbigras commented Aug 24, 2021

Description 🐜

When I check http://localhost:3000/api-example with the included test app I get TypeError: Cannot read property 'getToken' of undefined.

Is this a bug in your own project?

No

How to reproduce ☕️

git checkout v4.0.0-next.24
npm run dev:setup
npm run dev

Go to http://localhost:3000/api-example

Screenshots / Logs 📽

image

❯ npm run dev

> next-auth@0.0.0-semantically-released dev
> cd app && npm run dev


> next-auth-app@1.0.0 dev
> npm-run-all --parallel copy:app dev:css dev:next


> next-auth-app@1.0.0 dev:css
> npm-run-all --parallel watch:css copy:css


> next-auth-app@1.0.0 dev:next
> next dev


> next-auth-app@1.0.0 copy:app
> cpx "../src/**/*" next-auth --watch

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /home/bbigras/dev/next-auth/app/.env.local

> next-auth-app@1.0.0 copy:css
> cpx "../dist/css/**/*" dist/css --watch


> next-auth-app@1.0.0 watch:css
> cd .. && npm run watch:css

info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5

> next-auth@0.0.0-semantically-released watch:css
> postcss --config config/postcss.config.js --watch src/**/*.css --base src --dir dist

event - compiled successfully
event - build page: /api-example
wait  - compiling...
event - compiled successfully
event - build page: /api/examples/session
wait  - compiling...
event - build page: /api/examples/jwt
TypeError: Cannot read property 'getToken' of undefined
    at __WEBPACK_DEFAULT_EXPORT__ (webpack-internal:///./pages/api/examples/jwt.js:10:74)
    at Object.apiResolver (/home/bbigras/dev/next-auth/app/node_modules/next/dist/server/api-utils.js:101:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async DevServer.handleApiRequest (/home/bbigras/dev/next-auth/app/node_modules/next/dist/server/next-server.js:760:9)
    at async Object.fn (/home/bbigras/dev/next-auth/app/node_modules/next/dist/server/next-server.js:651:37)
    at async Router.execute (/home/bbigras/dev/next-auth/app/node_modules/next/dist/server/router.js:205:32)
    at async DevServer.run (/home/bbigras/dev/next-auth/app/node_modules/next/dist/server/next-server.js:825:29)
    at async DevServer.handleRequest (/home/bbigras/dev/next-auth/app/node_modules/next/dist/server/next-server.js:292:20)
event - compiled successfully
event - build page: /api/auth/[...nextauth]
wait  - compiling...
event - compiled successfully
[next-auth][warn][JWT_AUTO_GENERATED_ENCRYPTION_KEY]
https://next-auth.js.org/warnings#jwt_auto_generated_encryption_key
[next-auth][warn][JWT_AUTO_GENERATED_SIGNING_KEY]
https://next-auth.js.org/warnings#jwt_auto_generated_signing_key

Environment 🖥

  System:
    OS: Linux 5.13 NixOS 21.11 (Porcupine) 21.11 (Porcupine)
    CPU: (4) x64 Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
    Memory: 915.64 MB / 15.59 GB
    Container: Yes
    Shell: 5.8 - /run/current-system/sw/bin/zsh
  Binaries:
    Node: 16.6.0 - /nix/store/p5dwpzmcskyc2yh39bacarlv4w60prj1-devshell-dir/bin/node
    npm: 7.19.1 - /nix/store/p5dwpzmcskyc2yh39bacarlv4w60prj1-devshell-dir/bin/npm
  Browsers:
    Firefox: 91.0.1
  npmPackages:
    next: ^11.0.1 => 11.0.1
    react: ^17.0.2 => 17.0.2

Contributing 🙌🏽

No, I am afraid I cannot help regarding this

@bbigras bbigras added the bug Something isn't working label Aug 24, 2021
@balazsorban44
Copy link
Member

balazsorban44 commented Aug 24, 2021

I ran the example app this morning, so it might be something with your setup. That said, moving to TypeScript will hopefully require less magic vercel/next.js#22867 for the dev app (right now there is a lot of file-watching/copy-paste hackery). Anyway, unfortunately, I wouldn't consider the dev app's bad behavior as an actual bug, because it is aimed at people who don't mind going deep into the core and development of next-auth. I'll keep this in mind and see if I can reproduce it, but I'm inclined to close this issue to reduce the maintenance burden. Hope you can understand 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants