Wrong thenable object in db.select
AliusDieMorietur opened this issue · 0 comments
AliusDieMorietur commented
Wrong execution order. Possibly wrong thenable object returned from db.select
Line 121 in 84e40c2
Code:
console.log('pre');
await domain.db
.select('ContentFolder', ['id'], {
name: 'Skills',
})
.then(([{ id }]) => console.log('ID', id));
console.log('mid');
lib.resources.skillsFolderId = await domain.db
.select('ContentFolder', ['id'], {
name: 'Skills',
})
.then(([{ id }]) => id);
console.log('post');
console.log('lib.resources.skillsFolderId', lib.resources.skillsFolderId);
Logs:
api_1 | 08:13:29 W1 log pre
api_1 | 08:13:29 W1 debug SELECT "id" FROM "ContentFolder" WHERE "name" = $1 [Skills]
api_1 | 08:13:29 W1 log mid
api_1 | 08:13:29 W1 debug SELECT "id" FROM "ContentFolder" WHERE "name" = $1 [Skills]
api_1 | 08:13:29 W1 log post
api_1 | 08:13:29 W1 log lib.resources.skillsFolderId undefined
api_1 | 08:13:29 W1 log skillsFolderId undefined
api_1 | 08:13:29 W1 debug
api_1 | SELECT "name"
api_1 | FROM "ContentFolder"
api_1 | WHERE "parentId" = $1 []
api_1 | 08:13:29 W1 warn No redis service detected, so quit client
api_1 | 08:13:29 W1 log ID 231