Open Code2Life opened 10 months ago
Would love to use bun instead!!!!
We know what we need to do to get the SDK working on bun but it'll be a significant lift and may not be prioritized just yet.
I too hope we will support more JS runtimes including bun and deno.
nodejs recommends against using createHook:
Stability: 1 - Experimental. Please migrate away from this API, if you can. We do not recommend using the createHook, AsyncHook, and executionAsyncResource APIs as they have usability issues, safety risks, and performance implications. Async context tracking use cases are better served by the stable AsyncLocalStorage API. If you have a use case for createHook, AsyncHook, or executionAsyncResource beyond the context tracking need solved by AsyncLocalStorage or diagnostics data currently provided by Diagnostics Channel, please open an issue at https://github.com/nodejs/node/issues describing your use case so we can create a more purpose-focused API.
The SDK uses v8 promise hooks createHook
, not async hooks.
We need this functionality for showing workflow stack traces.
Any updates on this? 👀
In case someone wondered: No, Bun 1.1.0 (out since Monday) does not support Temporal yet. :disappointed:
error: node:v8 createHook is not yet implemented in Bun.
at new NotImplementedError (internal:shared:20:28)
at internal:shared:3:70
at node:v8:3:46
at node:v8:77:30
at setPromiseHook (/home/mauro/Codice/in4matic/bun/temporal/node_modules/@temporalio/worker/lib/workflow/vm-shared.js:208:33)
at install (/home/mauro/Codice/in4matic/bun/temporal/node_modules/@temporalio/worker/lib/workflow/vm-shared.js:140:13)
at /home/mauro/Codice/in4matic/bun/temporal/node_modules/@temporalio/worker/lib/workflow/reusable-vm.js:139:8
at create (/home/mauro/Codice/in4matic/bun/temporal/node_modules/@temporalio/worker/lib/workflow/reusable-vm.js:138:21)
at /home/mauro/Codice/in4matic/bun/temporal/node_modules/@temporalio/worker/lib/workflow/workflow-worker-thread.js:10:36
at handleRequest (/home/mauro/Codice/in4matic/bun/temporal/node_modules/@temporalio/worker/lib/workflow/workflow-worker-thread.js:6:35)
nodejs recommends against using createHook:
Stability: 1 - Experimental. Please migrate away from this API, if you can. We do not recommend using the createHook, AsyncHook, and executionAsyncResource APIs as they have usability issues, safety risks, and performance implications. Async context tracking use cases are better served by the stable AsyncLocalStorage API. If you have a use case for createHook, AsyncHook, or executionAsyncResource beyond the context tracking need solved by AsyncLocalStorage or diagnostics data currently provided by Diagnostics Channel, please open an issue at https://github.com/nodejs/node/issues describing your use case so we can create a more purpose-focused API.
How to disable using createHook to avoid this error?
I have the same question as @hscj87 and the same request as the original issue text. Commenting just to bump up this thread.
it would be great to be able to run temporal worker with bun!
@bergundy Deno 2 has removed promiseHooks stubs (https://github.com/denoland/deno/issues/25977) to provide an environment where temporals check for promiseHooks is skipped https://github.com/temporalio/sdk-typescript/blob/faa64225a7f57154931a38c1fe612fc6520943b2/packages/worker/src/workflow/vm-shared.ts#L199-L202
I now have temporal clients and workers successfully working in deno 2.
I would love to know the implications for having an enviroment where there are no promise hooks. What do I lose using deno to run a temporal worker instead of using node (with version >=16.14)
We use promise hooks to capture stack traces that are used in the stack trace query feature that gives visibility into where your workflow is blocked at any given point.
Bun worker can not work Issue
I tried to use bun as temporal worker, when running temporal client it looked perfect, the workflow created with HTTP2+gRPC, which just supported in bun.js last month.
But when I ran temporal worker it can not work, even bun.sh had implement v8 compatible vm context sandbox. Firstly I found this issue:
Then, i tried to comment out the createHook code block, this error disappeared, but the core-bridge was broken
Additional context
Both Temporal and bun are really amazing. Since bun provide many out-of-box features and better performance than node.js, It would be great if temporal sdk can support bun worker.