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

[auth][error] TypeError: fetch failed - Use My Public Repo to Reproduce the Issue Consistently #9811

Closed
nvijayap opened this issue Jan 26, 2024 · 5 comments
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@nvijayap
Copy link

Environment

System:
OS: macOS 14.1.1
CPU: (8) arm64 Apple M1
Memory: 96.58 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.5.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 10.2.4 - /opt/homebrew/bin/npm
pnpm: 8.14.0 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 121.0.6167.85
Safari: 17.1
npmPackages:
@auth/core: 0.20.0 => 0.20.0

Reproduction URL

https://github.com/nvijayap/auth_core_undici

Describe the issue

. Unable to signin
. Provider is Keycloak
. Did yarn build first and then tried
. Here's the stack trace ...

[auth][error] TypeError: fetch failed
    at node:internal/deps/undici/undici:12442:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getAuthorizationUrl (file:///Users/nv/auth_core_undici/.output/server/node_modules/@auth/core/lib/actions/signin/authorization-url.js:18:35)
    at async Module.signIn (file:///Users/nv/auth_core_undici/.output/server/node_modules/@auth/core/lib/actions/signin/index.js:10:56)
    at async AuthInternal (file:///Users/nv/auth_core_undici/.output/server/node_modules/@auth/core/lib/index.js:58:24)
    at async Auth (file:///Users/nv/auth_core_undici/.output/server/node_modules/@auth/core/index.js:104:29)
    at async file:///Users/nv/auth_core_undici/.output/server/node_modules/@hattip/adapter-node/dist/chunk-H2MKLSMM.js:37:24
    at async Object.handler (file:///Users/nv/auth_core_undici/.output/server/chunks/nitro/node-server.mjs:2751:19)
    at async Server.toNodeHandle (file:///Users/nv/auth_core_undici/.output/server/chunks/nitro/node-server.mjs:2940:7)

NOTE: No issue when yarn run dev is used

How to reproduce

Steps to reproduce the issue ...

  1. git clone https://github.com/nvijayap/auth_core_undici
  2. cd auth_core_undici
  3. Place the .env shown in README.md
  4. ./run.sh
  5. Visit http://localhost:3000 in browser
  6. Try to Sign in

Expected behavior

The signin should be successful as in the case of yarn run dev

@nvijayap nvijayap added bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Jan 26, 2024
@nvijayap nvijayap changed the title [auth][error] TypeError: fetch failed - Use Public Repo to Reproduce the Issue [auth][error] TypeError: fetch failed - Use My Public Repo to Reproduce the Issue Consistently Jan 26, 2024
@SriniJ888
Copy link

I am facing the same exact issue.

In trying to eliminate tech stack dependencies, I did a matrix test with stable node versions and build tools, while staying on the same Nuxt/Vue/AuthCore versions.

I tried with node versions 21.5.0, 20.11.0, 18.19.0 (stable versions) as well as with yarn, npm, pnpm (pkg managers). In all cases, the dev mode works fine and the build mode failed, even on local mac. Easily reproducible by using the github link mentioned above.

This has been a show stopper to deploy my app to my cloud servers.
Any and all help will be greatly appreciated.

Thanks in advance for your help.

@nvijayap
Copy link
Author

Issue resolved by setting env vars for the lines in .env

@aakash14goplani
Copy link

aakash14goplani commented Mar 15, 2024

@nvijayap @SriniJ888 - can you please tell which env variables helped you resolve this issue?

@sum7k
Copy link

sum7k commented Jun 2, 2024

Replacing localhost by 127.0.0.1 in issuer in Keycloak options solved it for me. (auth.ts file).
#9819 (comment)

@yaredow
Copy link

yaredow commented Jul 13, 2024

Issue resolved by setting env vars for the lines in .env

What does this even mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

5 participants