Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[❗️Error Handling] [Login/Register] 데이터베이스 접근시 오류 발생하는 문제 #29

Closed
lovelysi0113 opened this issue Apr 29, 2021 · 2 comments
Assignees
Labels
Complete [Error Handling] Progress Error Handling [Error Handling]

Comments

@lovelysi0113
Copy link
Collaborator

어떤 에러인가요?

  • findOne(), create() 등의 함수를 사용해서 데이터베이스에 접근할 때 문제가 발생하였다

에러 메시지

(node:12358) UnhandledPromiseRejectionWarning: TypeError: Class constructor Model cannot be invoked without 'new'
    at new user (/Users/ssong/Desktop/Code States/Full_IM_Course/Project_First_Trollo/Trollo-server/src/db/models/user.ts:24:42)

스크린샷 2021-04-29 오전 11 30 58

에러 핸들링 방법

  • sequelize Model을 typescript로 작성하였기에 typescript의 옵션 부분(tsconfig.json)을 수정해주어야 한다
{
    "compilerOptions": {
        "target": "es6", 
        ...
}

에러 핸들링을 위해 참고한 레퍼런스 링크

Class constructor Model cannot be invoked without 'new' and how getter v4 work?
스크린샷 2021-04-29 오전 11 35 53

@lovelysi0113 lovelysi0113 added the Error Handling [Error Handling] label Apr 29, 2021
@lovelysi0113 lovelysi0113 changed the title [❗️Error Handling] [마일스톤] 설명 [❗️Error Handling] [Login/Register] 데이터베이스 접근시 오류 발생하는 문제 Apr 29, 2021
@lovelysi0113 lovelysi0113 added the Complete [Error Handling] Progress label Apr 29, 2021
@lovelysi0113
Copy link
Collaborator Author

lovelysi0113 commented Apr 29, 2021

다행히 오류 메시지로 검색하니까 금방 해결 방법을 찾을 수 있었다!

검색어

Class constructor Model cannot be invoked without 'new'

@gatsukichi
Copy link
Collaborator

감사합니다. 감사합니다 .감사합니다 🙏 🙏 🙏 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete [Error Handling] Progress Error Handling [Error Handling]
Projects
None yet
Development

No branches or pull requests

2 participants