시퀄라이즈(Sequelize) 트랜젝션 사용 도중
Cannot read property 'uuid' of undefined라는 알 수 없는 에러가 뜨며 실행불가.
uuid? 내가 선언한 적도 없는 변수였다.
구글링을 해보니, 깃헙에 해결책이 있었다!
github.com/sequelize/sequelize/issues/8125
Just wanted to add that this often happens to me when I forget to await the transaction.
// Causes error:
const transaction = sequelize.transaction()
await User.findByPk(1, {transaction})
// Doesn't cause error:
const transaction = await sequelize.transaction()
await User.findByPk(1, {transaction})
sequelize.transaction() 앞에 await만 추가해주면 되는 간단한 문제였다.
[Sequelize] 시퀄라이저, 시퀄라이즈 기본 사용법 (0) | 2020.08.30 |
---|---|
[Sequelize] AssertionError [ERR_ASSERTION]: Missing where attribute in the options parameter (0) | 2020.08.30 |