dataform-co / dataform

Dataform is a framework for managing SQL based data operations in BigQuery
https://cloud.google.com/dataform/docs
Apache License 2.0
853 stars 165 forks source link

VSCode extension fails to compile projects in windows #1813

Closed moker-spaghetti closed 2 months ago

moker-spaghetti commented 3 months ago

Expected Behavior

VSCode compile should work when dataform compile runs successfully on the normal terminal.

Current Behavior

Dataform language server crashes with the output below.

Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:799:9)
    at compileAndValidate (c:\Users\moker\.vscode\extensions\dataform.dataform-0.0.15\server.js:45:44)
    at c:\Users\moker\.vscode\extensions\dataform.dataform-0.0.15\server.js:24:15 {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'spawn'
}

Possible Solution

This might be caused by Node.js security update which disabled *.cmd file spawn without { shell: true }. The updated Node.js has been shipped with VSCode = v1.92 or above. Adding { shell: true } option might solve this issue, but the security aspect should be discussed.

Environment

OS: Win11 dataformCoreVersion: 3.0.0 Dataform CLI version: 3.0.0 VSCode version: 1.92.2 VSCode extension version: 0.0.15

Ekrekr commented 2 months ago

Thanks for debugging this! It should be fine to pass { shell: true } - I don't think we have an alternative way to do this anyway.