nextauthjs / nextauthjs/next-auth

SvelteKit Auth, (Google), TypeError ("response" must be an instance of Response)

Open
#8,943 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Provider type

Google

Environment

Environment

System:

  • OS: Windows 10 10.0.22621
  • CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
  • Memory: 4.44 GB / 15.35 GB
    Binaries:
  • Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
  • Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
  • npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  • pnpm: 7.17.1 - C:\Program Files\nodejs\pnpm.CMD
    Browsers:
  • Edge: Chromium (118.0.2088.61)
  • Internet Explorer: 11.0.22621.1
Reproduction URL

https://github.com/notarib-catcher/fest-msite-sveltk

Describe the issue

I am hosting my sveltekit site on Vercel's Hobby plan, we're using authjs for sveltekit with google as the provider to authenticate users.
The version of Authjs I'm using in live is @auth/sveltekit 0.3.10, the error is occuring even when I update to 0.3.11 (latest)
The error seems to be a TypeError that occurs when attempting to login.
So far, I have only attempted this with the google auth provider.

To be completely honest, I am at a loss for why this error is occuring.

  • The error only occurs on live production and not on dev deployments - Login works fine on dev
  • I am unable to reproduce it on the local dev server (vite dev)
  • The error came up without intervention: We made a new deployment with CSS and some text changes that triggered it
  • The error seems to have come up after the vercel incident last night (Degraded performance: Assigning domains) however, this may also be coincidence.
How to reproduce

Since this error is rather specific to my deployment, I cannot provide a proper steps-to-reproduce, however here is the error log from vercel's runtime logs

[POST] /auth/signin/google

[auth][cause]: TypeError: "response" must be an instance of Response
    at Module.processDiscoveryResponse (file:///var/task/node_modules/oauth4webapi/build/index.js:212:15)
    at getAuthorizationUrl (file:///var/task/node_modules/@auth/core/lib/oauth/authorization-url.js:19:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Module.signin (file:///var/task/node_modules/@auth/core/lib/routes/signin.js:15:20)
    at async AuthInternal (file:///var/task/node_modules/@auth/core/lib/index.js:112:36)
    at async Auth (file:///var/task/node_modules/@auth/core/index.js:100:30)
    at async respond (file:///var/task/.svelte-kit/output/server/index.js:2523:22)
    at async Server.default (file:///var/task/.svelte-kit/vercel-tmp/index.js:47:3)
    at async Server.<anonymous> (/var/task/___vc/__launcher/__launcher.js:14:11367)

[auth][details]: {
  "provider": "google"
}

[auth][error][SignInError]: Read more at https://errors.authjs.dev#signinerror
Expected behavior

The user should be signed in with google

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 Vercel runtime stack trace, especially oauth4webapi/build/index.js and @auth/core/lib/oauth/authorization-url.js, then compare the production and development environments around Google sign-in. The issue is resolved when the production SvelteKit deployment completes Google authentication without the Response TypeError.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.