NextAuth request fails on production server #4113
-
I'm using NextAuth with the Spotify Provider for my project. When running in development mode, I don't get any issues. However, when building my site and running I thought that this might be an issue with my SSL as macOS is known for messed up SSL, but I had the same issue after deploying to Vercel. GitHub repo - DillonB07/spotify-clone
I changed the Has anyone ever encountered this, and what should I do to fix it? Thanks, Error log[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 ::1:3000 {
error: {
message: 'request to http://localhost:3000/api/auth/providers failed, reason: connect ECONNREFUSED ::1:3000',
stack: 'FetchError: request to http://localhost:3000/api/auth/providers failed, reason: connect ECONNREFUSED ::1:3000\n' +
' at ClientRequest.<anonymous> (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/next/dist/compiled/node-fetch/index.js:1:64142)\n' +
' at ClientRequest.emit (node:events:520:28)\n' +
' at Socket.socketErrorListener (node:_http_client:442:9)\n' +
' at Socket.emit (node:events:520:28)\n' +
' at emitErrorNT (node:internal/streams/destroy:164:8)\n' +
' at emitErrorCloseNT (node:internal/streams/destroy:129:3)\n' +
' at processTicksAndRejections (node:internal/process/task_queues:83:21)',
name: 'FetchError'
},
path: 'providers',
message: 'request to http://localhost:3000/api/auth/providers failed, reason: connect ECONNREFUSED ::1:3000'
}
TypeError: Cannot convert undefined or null to object
at Function.values (<anonymous>)
at Login (/Users/dillonbarnes/Documents/Coding/React/spotify-2/.next/server/pages/login.js:31:20)
at d (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
at bb (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
at a.b.render (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
at a.b.read (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
at Object.exports.renderToString (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
at Object.renderPage (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/next/dist/server/render.js:751:45)
at Object.defaultGetInitialProps (/Users/dillonbarnes/Documents/Coding/React/spotify-2/node_modules/next/dist/server/render.js:389:51)
at Function.getInitialProps (/Users/dillonbarnes/Documents/Coding/React/spotify-2/.next/server/pages/_document.js:530:20) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Did you configure everything on Spotify's api site? Maybe it's none of the above but I remember something like it from a video I watched... It was this one, it worked for me Let's buiild Spotify 2.0 - YouTube |
Beta Was this translation helpful? Give feedback.
Did you configure everything on Spotify's api site?
Did you use the secret, and key they provided?
Did you set up token refresh logic?
Maybe it's none of the above but I remember something like it from a video I watched...
It was this one, it worked for me Let's buiild Spotify 2.0 - YouTube