Skip to content
New issue

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

Implement promiseHooks from node:v8 #6136

Open
bkniffler opened this issue Sep 28, 2023 · 8 comments
Open

Implement promiseHooks from node:v8 #6136

bkniffler opened this issue Sep 28, 2023 · 8 comments
Labels
enhancement New feature or request node.js Compatibility with Node.js APIs

Comments

@bkniffler
Copy link

What is the problem this feature would solve?

When trying to use temporal sdk (https://github.com/temporalio/sdk-typescript), getting error

node:v8 createHook is not yet implemented in Bun

Its used right here:
https://github.com/temporalio/sdk-typescript/blob/3ce098be042e86d26ea5b433508a480503cb09b2/packages/worker/src/workflow/vm-shared.ts#L198

What is the feature you are proposing to solve the problem?

Implement createHook.

What alternatives have you considered?

Ask temporal to not use createHook, but probably out of reach since its needed to isolate the VM scope.

@bkniffler bkniffler added the enhancement New feature or request label Sep 28, 2023
@Electroid Electroid added the node.js Compatibility with Node.js APIs label Sep 28, 2023
@Electroid Electroid changed the title Temporal typescript SDK compatibility - node:v8 createHook is not yet implemented in Bun Implement promise hooks from node:v8 Sep 28, 2023
@Electroid
Copy link
Contributor

We'd have to think about if this is worth implementing, since it could have a performance impact. (it tracks all promises) However, even if it is feasible, it's not a high priority.

@Electroid Electroid changed the title Implement promise hooks from node:v8 Implement promiseHooks from node:v8 Sep 28, 2023
@alirezabonab
Copy link

@Electroid Is there any update on this?

@danieldunderfelt
Copy link

danieldunderfelt commented Feb 5, 2024

Sadly the Temporal Typescript SDK does not work without createHook 😩

I'd love to have it at least as an opt-in if the performance impact is big.

Ping @lorensr

@loicnestler
Copy link

What's the status on this? Is an implementation of createHook planned?

@bergundy
Copy link

I'm the author of the code you linked in the Temporal TypeScript SDK.
Promise hooks are optional, they allow us to capture the stack trace of all running functions in a workflow.
I'm not sure if there's more of a gap for running our SDK on top of Bun but we can look into it.
Apart from promise hooks, we use Node's vm and worker_threads modules, AsyncLocalStorage, and rely heavily on Rust Neon bindings.

@paradoxloop
Copy link

@bergundy if Promise Hooks are optional is there a way to disable them so that we can use Bun. There is a linked issue on the Temporal project.

@axe-me
Copy link

axe-me commented Oct 11, 2024

Can bun simply keep silent about this instead of throw an error, if there is no plan to implement this in short time. Just like what deno did in this PR: https://github.com/denoland/deno/pull/25979/files

maybe just use warnNotImplementedOnce in here:

bun/src/js/node/v8.ts

Lines 101 to 117 in 25fcbed

const promiseHooks = {
createHook: () => {
notimpl("createHook");
},
onInit: () => {
notimpl("onInit");
},
onBefore: () => {
notimpl("onBefore");
},
onAfter: () => {
notimpl("onAfter");
},
onSettled: () => {
notimpl("onSettled");
},
},

or just simply remove the promiseHooks object

@bergundy
Copy link

#14485 seems like the way to go. If it ends up not getting merged, we may be able to do something on the Temporal SDK side, it should be easy to edit the SDK files post install to remove the use of promise hooks and confirm.
I’m subscribed to this issue, wondering if this is the last hurdle for running the Temporal SDK on bun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

8 participants