[Saida Lab] Next-auth 적용하기 (3)_build error

https://next-auth.js.org/

 

 

이제 로그인과 관련된 기능들도 잘 동작하고 끝났다고 생각 했는데,

요기 베라의 명언은 이 개발씬에서도 매번 적용이 되는거 같다.

 

끝날 때까지 끝난게 아니다
- Yogi Berra

 


왜 또 뭐가 문제인데?

 

 

이번에는 build 과정에서 발생한 문제였다.

 

 

Type error: ...

  Property 'authOptions' is incompatible with index signature.
    Type 'AuthOptions' is not assignable to type 'never'.

   6 |
   7 | // Check that the entry is a valid entry
>  8 | checkFields<Diff<{
     |             ^
   9 |   GET?: Function
  10 |   HEAD?: Function
  11 |   OPTIONS?: Function
- info Linting and checking validity of types ...

 

빌드를 돌리니 이런 에러가 뙇 하고 등장했는데,

이 부분은 stackoverflow 형님들 덕분에 빠르고 깔끔하게 해결했다.

 

 

 

Next.js 13.4 and NextAuth Type Error: 'AuthOptions' is not assignable to type 'never'

I'm currently working on a Next.js 13.4 project and trying to set up NextAuth using the app/ router. However, I'm encountering a type error that I can't seem to resolve. Here's my route.ts file: im...

stackoverflow.com

 

위에 있는 링크를 통해서 가면 볼 수 있는데, 요약하자면 authOptions 부분을 분리해서

route.ts 파일에 import 해서 사용하라는 뜻이었다.

 

추가로 나와 같은 에러, 나와 같은 방법으로 해결한 분의 블로그가 있어서

샤라웃 하는 마음으로 참고 자료에 링크 걸어놨다 ㅋㅋ

 


 

참고 자료

 

- 같은 에러 블로그