'Vercel 500 internal error! Cannot get logged in

    [GET] /auth/signin?callbackUrl=http://localhost:3000
17:22:23:77
2021-10-24T12:22:24.062Z    a07d6ace-3b47-4472-a45b-f7ef9989a9b5    ERROR   [next-auth][error][CLIENT_FETCH_ERROR] 
https://next-auth.js.org/errors#client_fetch_error request to http://localhost:3000/api/auth/providers failed, reason: connect ECONNREFUSED 127.0.0.1:3000 {
  error: {
    message: 'request to http://localhost:3000/api/auth/providers failed, reason: connect ECONNREFUSED 127.0.0.1:3000',
    stack: 'FetchError: request to http://localhost:3000/api/auth/providers failed, reason: connect ECONNREFUSED 127.0.0.1:3000\n' +
      '    at ClientRequest.<anonymous> (/var/task/node_modules/node-fetch/lib/index.js:1461:11)\n' +
      '    at ClientRequest.emit (events.js:400:28)\n' +
      '    at Socket.socketErrorListener (_http_client.js:475:9)\n' +
      '    at Socket.emit (events.js:400:28)\n' +
      '    at emitErrorNT (internal/streams/destroy.js:106:8)\n' +
      '    at emitErrorCloseNT (internal/streams/destroy.js:74:3)\n' +
      '    at processTicksAndRejections (internal/process/task_queues.js:82:21)',
    name: 'FetchError'
  },
  path: 'providers',
  message: 'request to http://localhost:3000/api/auth/providers failed, reason: connect ECONNREFUSED 127.0.0.1:3000'
}
2021-10-24T12:22:24.099Z    a07d6ace-3b47-4472-a45b-f7ef9989a9b5    ERROR   TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at SignIn (/var/task/.next/server/pages/auth/signin.js:75:26)
    at d (/var/task/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
    at bb (/var/task/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
    at a.b.render (/var/task/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
    at a.b.read (/var/task/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
    at Object.exports.renderToString (/var/task/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
    at Object.renderPage (/var/task/node_modules/next/dist/server/render.js:596:45)
    at Function.getInitialProps (/var/task/.next/server/pages/_document.js:601:19)
    at Object.loadGetInitialProps (/var/task/node_modules/next/dist/shared/lib/utils.js:69:29) {
  page: '/auth/signin'
}
RequestId: a07d6ace-3b47-4472-a45b-f7ef9989a9b5 Error: Runtime exited with error: exit status 1
Runtime.ExitError

I am using vercel for hosting and after a week of coding and finally uploading the build when I try to login it gives me this error I don't understand this and would really appreciate if any of you could help me this is the URL https://insta-2-0-ebon.vercel.app/ of the app



Solution 1:[1]

If you are using .env(process.env) file check your variable must have prefix NEXT_PUBLIC_ if not check your URL back-end you are currently using localhost

Solution 2:[2]

I had the same issue, and it is not only about the NEXTAUTH_URL to be added if you are using an adapter, for me it was MongoDB don't forget to add MONGODB_URI variable, but I also spent a lot of time and the error message was misleading but finally after adding the connection URI of mongo it works

Solution 3:[3]

If you using next.js, try adding NEXT_PUBLIC_VERCEL_URL. https://vercel.com/docs/concepts/projects/environment-variables#

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tài H?
Solution 2 medhatdawoud
Solution 3 Itta