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

bug: simple TypeScript snippet results in 100% reproduction of "Failed to scan imports" #5077

Closed
bbugh opened this issue Jan 16, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bbugh
Copy link

bbugh commented Jan 16, 2025

Describe the bug

Hello! 👋 Thanks for making Windmill. I've wanted this to exist for a long time but didn't want to create it myself.

I was receiving a surprising error after making a small change to a workflow step. With the reproduction code below, this error occurs 100% of the time.

ExitCode: 1, last log lines:
job=01946fc7-a99e-f07a-fd90-a948327d26c4 tag=bun worker=wk-default-gw4n9-Ral3o hostname=windmill-workers-66c8c76bfd-gw4n9


--- BUN INSTALL ---

error: Failed to scan imports
    at /tmp/windmill/wk-default-gw4n9-Ral3o/01946fc7-a99e-f07a-fd90-a948327d26c4/main.ts:0"

To reproduce

After researching bun and windmill execution and so on to no avail, I started just randomly removing code in case bun or the runner was panicking on some weird edge case. And it was!

Given these two identically-functional but differently-defined functions:

function randomElement<T>(arr: T[]): T { return arr[Math.floor(Math.random() * arr.length)]; }
const randomElement = <T>(arr: T[]): T => arr[Math.floor(Math.random() * arr.length)];]]
  1. if you use the function line, the code will run and execute.
  2. if you use the const line, you will get the "failed to scan imports" error 100%.

Expected behavior

This snippet with either function form works in all execution environments, so it probably should work with Windmill:

function randomElement<T>(arr: T[]): T { return arr[Math.floor(Math.random() * arr.length)]; }
console.log(randomElement([1, 2, 3, 4, 5]))

and

const randomElement = <T>(arr: T[]): T => arr[Math.floor(Math.random() * arr.length)];
console.log(randomElement([1, 2, 3, 4, 5]))
  1. ✅ tsx
  2. ✅ bun
  3. ✅ Deno

Screenshots

No response

Browser information

Firefox 134.0.1

Application version

EE v1.447.2-4-gfddcaca80

Additional Context

(Probably ought to also check the github template for where to find the 'Application version' above, because that doesn't seem to exist. Not sure if that is the right version you were looking for, which was under User -> Account Settings -> text under "Windmill")

@bbugh bbugh added the bug Something isn't working label Jan 16, 2025
@rubenfiszel
Copy link
Contributor

Should be fixed on very latest, was due to using tsx for bun transpiler to extract imports instead of ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants