nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
24.1k stars 3.34k forks source link

The "listener" argument must be of type function. Received an instance of Object - Google oAuth Error #9104

Closed mikeacre closed 10 months ago

mikeacre commented 10 months ago

Environment

npx: installed 1 in 2.537s

System: OS: Linux 5.4 Ubuntu 18.04.1 LTS (Bionic Beaver) CPU: (1) x64 Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz Memory: 271.43 MB / 1.93 GB Container: Yes Shell: 4.4.20 - /bin/bash Binaries: Node: 12.18.3 - /usr/local/bin/node npm: 6.14.6 - /usr/local/bin/npm

npx: installed 1 in 2.093s

npmPackages: next: ^12.2.5 => 12.2.5 next-auth: ^4.22.1 => 4.22.1 react: 18.2.0 => 18.2.0

npx: installed 1 in 0.981s

Reproduction URL

n/a

Describe the issue

It appears on certain devices, after a successful login, after about a day or so they will no longer be able to login. I am running this as production on an AWS server. ~10-15 users for internal use app using google oAuth for login only.

I know it must have something to do with the tokens not refreshing for certain users. Is there a way to force this refresh? Or maybe I missed something?

Full Error:

[next-auth][error][SIGNIN_OAUTH_ERROR] 
 https://next-auth.js.org/errors#signin_oauth_error The "listener" argument must be of type function. Received an instance of Object {
   error: {
     message: 'The "listener" argument must be of type function. Received an instance of Object',
     stack: 'TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object\n' +
       '    at checkListener (node:events:266:3)\n' +
       '    at ClientRequest.once (node:events:647:3)\n' +
       '    at new ClientRequest (node:_http_client:237:10)\n' +
       '    at Object.request (node:https:357:10)\n' +
       '    at Object.<anonymous> (/home/ubuntu/git_dirs/lmsign-full/next-display/node_modules/proxy-agent/node_modules/agent-base/patch-core.js:25:22)\n' +
       '    at /home/ubuntu/git_dirs/lmsign-full/next-display/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js:23:20\n' +
       '    at Function.request (/home/ubuntu/git_dirs/lmsign-full/next-display/node_modules/openid-client/lib/helpers/request.js:120:73)\n' +
       '    at Function.discover (/home/ubuntu/git_dirs/lmsign-full/next-display/node_modules/openid-client/lib/issuer.js:144:38)\n' +
       '    at openidClient (/home/ubuntu/git_dirs/lmsign-full/next-display/node_modules/next-auth/core/lib/oauth/client.js:16:41)\n' +
       '    at getAuthorizationUrl (/home/ubuntu/git_dirs/lmsign-full/next-display/node_modules/next-auth/core/lib/oauth/authorization-url.js:70:49)',
     name: 'TypeError'
   },
   providerId: 'google',
   message: 'The "listener" argument must be of type function. Received an instance of Object'
 }

Next Auth

GoogleProvider({
            clientId: process.env.GOOGLE.CLIENT_ID,
            clientSecret: process.env.GOOGLE.SECRET,
            callbackUrl: "HIDDEN",
            authorization: {
                params: {
                    prompt: "consent",
                    access_type: "offline",
                    response_type: "code"
                }
            }
        }),

How to reproduce

Not sure whats causing this issue, is only happening on 1 or 2 different devices. Has occurred on a device once and then never occurred again. Other device is having an issue every day.

Expected behavior

Should allow login.

github-actions[bot] commented 10 months ago

We could not detect a valid reproduction link. Make sure to follow the bug report template carefully.

Why was this issue closed?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We need a link to a public GitHub repository. Example: (NextAuth.js example repository).

The bug template that you filled out has a section called "Reproduction URL", which is where you should provide the link to the reproduction.

What should I do?

Depending on the reason the issue was closed, you can do the following:

In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.

My repository is private and cannot make it public

In most cases, a private repo will not be a sufficient minimal reproduction, as this codebase might contain a lot of unrelated parts that would make our investigation take longer. Please do not make it public. Instead, create a new repository using the templates above, adding the relevant code to reproduce the issue. Common things to look out for:

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps by opening a new issue.

I think my reproduction is good enough, why aren't you looking into it quickly?

We look into every issue and monitor open issues for new comments.

However, sometimes we might miss a few due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources