Open crishoj opened 1 month ago
i've avoided implementing createHook because it has very concerning performance characteristics, and the node.js docs mark it as an experimental feature; Stability: 1. most code using createHook can use async_hooks.AsyncLocalStorage
prisma optimize is using @opentelemetry/context-async-hooks
, which provides two exports: one using AsyncLocalStorage
(the API which is not marked experimental), and one using createHook
. It is probable that they can just use the other implementation (a one line change)
I'll keep this issue open until we can resolve Prisma Optimize.
Seeing a similar problem drizzle-kit
, so problem likely not restricted to prisma.
I’m experiencing the same issue in Next.js Canary with turbo: [bun] Warning: async_hooks.createHook is not implemented in Bun. Hooks can still be created but will never be called.
i believe this one in Next.js is from react-server
. for this case, the async hooks has no observable effect. the code in React is TODO and seems to be
I've been tempted to upstream removing this call. the warning it emits is useful for places like prisma optimize where the thing does depend on async hooks, we can identify that.
What is the problem this feature would solve?
Prisma Optimize, which just entered general availability, appears to rely on
async_hooks.createHook
:What is the feature you are proposing to solve the problem?
Implement
async_hooks.createHook
🙏 🥺What alternatives have you considered?
Going to bed instead of having fun with Bun 💤