Hi, When using MongoDB node.js driver with AsyncLocalStorage with Readable stream, asyncLocalStorage context is lost
minimal example of reproduction:
const { AsyncLocalStorage } = require('async_hooks')
const asyncLocalStorage = new AsyncLocalStorage()
asyncLocalStorage.run({ requestId: Math.random() }, async () => {
const findStream = await mongoConnection.collection('test').find(filter).stream();
findStream.on('end', () => {
asyncLocalStorage.getStore(); // requestId is lost here
});
});
Reproduced on:
NodeJs: 16.15.1
mongoDB node.Js version: 3.7.3