nextauthjs / nextauthjs/next-auth

getting TypeError: Failed to fetch

Open
#12,840 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Environment
 System:
    OS: macOS 15.1.1
    CPU: (8) arm64 Apple M1
    Memory: 664.33 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 9.15.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.4 - ~/.bun/bin/bun
    Watchman: 2024.11.25.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 134.1.76.82
    Chrome: 134.0.6998.166
    Safari: 18.1.1
  npmPackages:
    @auth/prisma-adapter: ^2.8.0 => 2.8.0 
    next: 15.2.3 => 15.2.3 
    next-auth: ^5.0.0-beta.25 => 5.0.0-beta.25 
    react: ^19.0.0 => 19.0.0 
Reproduction URL

https://github.com/ar-chit/twitter-clone

Describe the issue

While trying to log in using the Credentials provider, It throws TypeError: Failed to fetch in browser's console.

https://github.com/user-attachments/assets/2ecc4b6c-a46a-44b0-98c2-b46db4a162b6

Browser's console (development):

Image

Browser's console (production):

Image

Terminal:

Image

Network Tab:

Image
How to reproduce
  1. clone this repo: https://github.com/ar-chit/twitter-clone.git
  2. install dependencies: npm i
  3. start the project: npm run dev
  4. open the localhost link and try to login, you'll see the issue.

.env:
DATABASE_URL=postgres-url
AUTH_SECRET="izlp6unU+8O2DqrzSCJAeN1Ae/VAbvpADw7hDHTYD2U="

Alternatively, you can see the issue on https://twitter-clone-brown-delta.vercel.app

Expected behavior

The user shall log in successfully if the credentials entered are correct.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked twitter-clone reproduction and follow the documented npm i and npm run dev steps, then inspect the Credentials-provider login flow alongside the browser console, terminal, and Network tab output. Done means valid credentials complete login successfully in the local reproduction and deployed reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react, typescript
Domain
authentication, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.