next-auth: TypeError: Cannot read properties of undefined (reading 'split') in openid-client

Environment

I’m using NextJS, builds started failing on Vercel then I updated packages on dev and got the errors.

System: Shell: 5.8 - /usr/bin/zsh Binaries: Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.0/bin/yarn npm: 9.4.2 - ~/.nvm/versions/node/v18.12.0/bin/npm Browsers: Chrome: 110.0.5481.177 Firefox: 111.0.1

Reproduction URL

n/a

Describe the issue

Getting the following error when attempting to authenticate with nextjs with any provider.

TypeError: Cannot read properties of undefined (reading 'split') 

eval
node_modules/oidc-token-hash/lib/shake256.js (3:30)
./node_modules/oidc-token-hash/lib/shake256.js
file:///home/thomas/Flamingo/flamingo-aggregator/.next/static/chunks/pages/_app.js (14895:1)

In the shake256.js, process.versions.node is undefined

How to reproduce

    "next": "^13.3.0",
    "next-auth": "^4.22.0",
    "react-dom": "^18.2.0",
    "react": "^18.2.0",

My _app.js file:

export default function App({ Component, pageProps: {session, ...pageProps} }) {

  const [open, setOpen] = useState(false);

  return (
    <ErrorBoundary>
      <SessionProvider session={session}>
        <AuthProvider>
          <ThemeProvider>
            <RootStyle>
              <DashboardNavbar onOpenSidebar={() => setOpen(true)} />
                <DashboardSidebar isOpenSidebar={open} onCloseSidebar={() => setOpen(false)} />
                  <MainStyle>
                      <Component {...pageProps}  />
                  </MainStyle>
                </RootStyle>
          </ThemeProvider>
        </AuthProvider>
      </SessionProvider>
    </ErrorBoundary>
  )
}

Expected behavior

Authentication should be successful!

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 15 (1 by maintainers)

Most upvoted comments

You are likely using next-auth in the edge runtime, which is currently not supported.

Note: n/a is not a reproduction. Please always provide one to help your case.

@BEEFF FYI, the underlying issue for this problem appears to be related to the oidc-token-hash library, which had a release in the past couple of days with a change that’s got to be it -> https://github.com/panva/oidc-token-hash/pull/7/files#diff-d3a2bc859c51b926d253f72c9fb0f41e227cb0689b59c0df9533f2971aeb1e8eL3

Short-term, I have just fixed that dep to the previous version…

"overrides": {
    "oidc-token-hash": "5.0.1"
 }

For those of you using yarn, add the following to your package.json -

"resolutions": {
  "oidc-token-hash": "5.0.1"
}

I’m having success using next-auth@beta with next 14 but not fully done yet

@BEEFF FYI, the underlying issue for this problem appears to be related to the oidc-token-hash library, which had a release in the past couple of days with a change that’s got to be it -> https://github.com/panva/oidc-token-hash/pull/7/files#diff-d3a2bc859c51b926d253f72c9fb0f41e227cb0689b59c0df9533f2971aeb1e8eL3

Short-term, I have just fixed that dep to the previous version…

"overrides": {
    "oidc-token-hash": "5.0.1"
 }

@BEEFF FYI, the underlying issue for this problem appears to be related to the oidc-token-hash library, which had a release in the past couple of days with a change that’s got to be it -> https://github.com/panva/oidc-token-hash/pull/7/files#diff-d3a2bc859c51b926d253f72c9fb0f41e227cb0689b59c0df9533f2971aeb1e8eL3

Short-term, I have just fixed that dep to the previous version…

"overrides": {
    "oidc-token-hash": "5.0.1"
 }

@sobencha-mz Did this work for you? Did not work for me 😦

@BEEFF Any luck on this one? Also starting yesterday I have been running into the exact same issue. Fresh npm install after having deleted node_modules breaks everything so it must be a bad dep of a dep or something? Can confirm that it has nothing do to with edge runtime, or specifically Vercel-related; I’m using a pretty standard docker-based deployment to GKE. Regardless of deployment target, this is immediately reproducible locally (for me a least).