diff options
author | 2023-02-17 18:05:41 -0800 | |
---|---|---|
committer | 2023-02-17 18:05:41 -0800 | |
commit | 20d9483cd068358d364cd91e518dfb852521cd8b (patch) | |
tree | 813382d62ed4e56e84563904e501379bb199ae45 /src/bun.js/async_hooks.exports.js | |
parent | 155e3706b1ee3096f0b5df2ab1da02cd125df1d0 (diff) | |
download | bun-20d9483cd068358d364cd91e518dfb852521cd8b.tar.gz bun-20d9483cd068358d364cd91e518dfb852521cd8b.tar.zst bun-20d9483cd068358d364cd91e518dfb852521cd8b.zip |
Fix issue with express body-parser introduced by our async_hooks polyfill
Diffstat (limited to 'src/bun.js/async_hooks.exports.js')
-rw-r--r-- | src/bun.js/async_hooks.exports.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bun.js/async_hooks.exports.js b/src/bun.js/async_hooks.exports.js index 1b5664bc2..055159934 100644 --- a/src/bun.js/async_hooks.exports.js +++ b/src/bun.js/async_hooks.exports.js @@ -145,11 +145,19 @@ class AsyncResource { constructor(type, triggerAsyncId) { this.type = type; this.triggerAsyncId = triggerAsyncId; + + if (AsyncResource.allowedRunInAsyncScope.has(type)) { + this.runInAsyncScope = this.#runInAsyncScope; + } } type; triggerAsyncId; + // We probably will not fully support AsyncResource + // But some packages in the wild do depend on it + static allowedRunInAsyncScope = new Set(["prisma-client-request"]); + emitBefore() { return true; } @@ -160,7 +168,9 @@ class AsyncResource { emitDestroy() {} - runInAsyncScope(fn, ...args) { + runInAsyncScope; + + #runInAsyncScope(fn, ...args) { notImplemented(); var result, err; process.nextTick(fn => { |