Error when calling a bun script using `wmill.runScript`
I have a bun script, that uses
jsdom
as a dependency. The script is working as expected when calling it directly through the windmill cloud UI.
But now I try to create a second script, written in TS, and call the first script using
And this time I get the following error:
It seems related to the usage of jsdom
in bun
but it only occurs when calling a script using wmill.runScript
and not when calling it directly.14 Replies
@httpteapot UI and api uses absolutely exactly the same logic as they both use the api
I can try making a more minimal repro
nvm the null arg is for hash
Still an error with :
Isn't it the recommanded way to call a script "manually" in code without creating a flow?
(It works if I remove jsdom)
it doesn't make a difference calling it in code or with api or in a flow as far as the script execution is concerned
run it with //nobundling at the top
probably jsom doesn't support well to be bundled
Yes it works with nobundling
I tried to track down the issue locally running
bun build
on a script using jsdom
, but I can't reproduce the issue. How are scripts bundled in windmill? It's not using bun build
?it's using bun build
When I
bun build
the following file, and then execute it, it works
not sure, here is our bundler code: https://github.com/windmill-labs/windmill/blob/a24365237c8f4a0605512ecaf4a838b0d12f09ee/backend/windmill-worker/loader_builder.bun.js#L1
GitHub
windmill/backend/windmill-worker/loader_builder.bun.js at a24365237...
Open-source developer platform to power your entire infra and turn scripts into webhooks, workflows and UIs. Fastest workflow engine (13x vs Airflow). Open-source alternative to Retool and Temporal...
actually that's not what is ran
@httpteapot I investigated and you can reproduce the issue locally by removing node_modules after creating the bundle. The bundle still has references to files in the node_modules
Ok, so this is a bug with bun?
yes
Opened a bug report https://github.com/oven-sh/bun/issues/14011
GitHub
Reference to external module when bundling jsdom · Issue #14011 · o...
What version of Bun is running? 1.1.27+267afa293 What platform is your computer? Darwin 24.0.0 arm64 arm What steps can reproduce the bug? Bundling a script depending on jsdom is broken. To reprodu...
👍