We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
db.collection('rooms').get().then(rooms => { var roomID = []; rooms.forEach(room => { roomID.push(room.id); }); return roomID; }).then(async roomID => { for (let id of roomID) { let users = await db.collection('/room_users/' + id + '/list').get(); for (let user of users.docs) { try { let userData = await admin.auth().getUser(user.id); } catch (error) { console.log(error); } } } }).then(() => { console.log('done.'); });
async function foo() { let rooms = await db.collection('rooms').get(); for (let room of rooms.docs) { let users = await db.collection('/room_users/' + room.id + '/list').get(); for (let user of users.docs) { try { let userData = await admin.auth().getUser(user.id); console.log(userData.uid); } catch (error) { console.log(error); } } } console.log('Done.'); } console.log('Start.'); foo();
let userData = await admin.auth().getUser(user.id);
有這一行 NodeJS 無法結束, 已確定沒有其他 error , 也有輸出 done.
但就是結束不了
將 let userData = await admin.auth().getUser(user.id); 移除
輸出 done. 後能順利結束
The text was updated successfully, but these errors were encountered:
你需要補上 admin 這個變數及其下方法的程式碼
admin
方法名稱看起來有建立資料庫連線之類的行為,很可能是用完沒關閉,或者建立時沒 .unref()
.unref()
Sorry, something went wrong.
No branches or pull requests
第二個版本
遇到的問題
let userData = await admin.auth().getUser(user.id);
有這一行 NodeJS 無法結束, 已確定沒有其他 error , 也有輸出 done.
但就是結束不了
嘗試過的解法
將 let userData = await admin.auth().getUser(user.id); 移除
輸出 done. 後能順利結束
The text was updated successfully, but these errors were encountered: