next-auth로 기존에 이미 연동해두었던 구글 소셜에 카카오 소셜 로그인을 추가했을 뿐인데, 아래와 같은 에러가 발생을 했다.
[auth][error] TypeError: Invalid URL
at new URL (node:internal/url:797:36)
at getAuthorizationUrl (../../node_modules/.pnpm/@[email protected]/node_modules/@auth/core/lib/actions/signin/authorization-url.js:22:24)
at Module.signIn (../../node_modules/.pnpm/@[email protected]/node_modules/@auth/core/lib/actions/signin/index.js:16:136)
at AuthInternal (../../node_modules/.pnpm/@[email protected]/node_modules/@auth/core/lib/index.js:72:77)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Auth (../../node_modules/.pnpm/@[email protected]/node_modules/@auth/core/index.js:127:34)
at async signIn (../../node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/next-auth/lib/actions.js:53:7)
at async $$ACTION_1 (./src/app/(public)/login/_action/index.ts:38:5)
at async /node_modules/.pnpm/[email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:418
at async rk (/node_modules/.pnpm/[email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7978)
at async r3 (/node_modules/.pnpm/[email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:41:1256)
at async doRender (/node_modules/.pnpm/[email protected]/node_modules/next/dist/server/base-server.js:1420:30)
at async cacheEntry.responseCache.get.routeKind (/node_modules/.pnpm/[email protected]/node_modules/next/dist/server/base-server.js:1581:28)
at async DevServer.renderToResponseWithComponentsImpl (/node_modules/.pnpm/[email protected]/node_modules/next/dist/server/base-server.js:1489:28)
at async DevServer.renderPageComponent (/node_modules/.pnpm/[email protected]/node_modules/next/dist/server/base-server.js:1913:2)
at async DevServer.renderToResponseImpl (/node_modules/.pnpm/[email protected]/node_modules/next/dist/server/base-server.js:1951:2)
at async DevServer.pipeImpl (/node_modules/.pnpm/[email protected]/node_modules/next/dist/server/base-server.js:917:25)
at async NextNodeServer.handleCatchallRenderRequest (/node_modules/.pnpm/[email protected]/node_modules/next/dist/server/next-server.js)
위 로그를 확인해보았을 때 핵심적으로 보이는 에러 메세지의 경우 TypeError: Invalid URL at new URL
이다.
구글 소셜 로그인의 경우 문제가 없는데, 카카오 소셜 로그인에서만 문제가 발생을 했다..? 먼저 관련 에러들을 구글링 해보면서 카카오 소셜 로그인 설정을 살펴보았다.
구글링 후 가장 많이 검색되는 내용은 NEXTAUTH_URL
설정으로, env설정시