aspect-build / rules_js

High-performance Bazel rules for running Node.js tools and building JavaScript projects
https://docs.aspect.build/rules/aspect_rules_js
Apache License 2.0
300 stars 103 forks source link

[Bug]: cannot parse invalid wire-format data with ibazel + rules_js #1528

Open Aghassi opened 6 months ago

Aghassi commented 6 months ago

What happened?

Occasionally when running ibazel on a webpack_dev_server target, we see an error that looks similar to this

iBazel [1:01PM]: Querying for files to watch...
iBazel [1:01PM]: Running //project:dev_server
Could not read blaze query response. Error: proto: cannot parse invalid wire-format data
Output:
�"
��!
//project:dev_server_js_run_devserver:/Users/davidaghassi/robinhood/rh/project/BUILD.bazel:68:18"s
$config_dependencies2$@aspect_rules_js//js:enable_runfiles2.@aspect_rules_js//js:allow_unresolved_symlinksh�"
$is_executable*truehp"J
$launcher_template*-@aspect_rules_js//js/private:js_binary.sh.tplh�"M
$node_patches*5@aspect_rules_js//js/private/node-patches:register.jsh�"M
$node_patches_files2/@aspect_rules_js//js/private/node-patches:fs.jsh�"[
$node_patches_legacy*<@aspect_rules_js//js/private/node-patches_legacy:register.jsh�"[
$node_patches_legacy_files26@aspect_rules_js//js/private/node-patches_legacy:fs.jsh�"I
$node_wrapper_bat*-@aspect_rules_js//js/private:node_wrapper.bath�"G
$node_wrapper_sh*,@aspect_rules_js//js/private:node_wrapper.shh�"G
$npm_wrapper_bat*,@aspect_rules_js//js/private:npm_wrapper.bath�"E
$npm_wrapper_sh*+@aspect_rules_js//js/private:npm_wrapper.shh�"4
$windows_constraint*@platforms//os:windowsh�"
:action_listenerh�"D
3allow_execroot_entry_point_with_no_copy_data_to_bin*falsehp"
applicable_licensesh�"�
args2serve--config2($(rootpath dev_server.webpack.config.js)--config23$(rootpath //project/configs:webpack.dev.config.js)2--merge2--mode2
   developmenth�"

aspect_hintsh�"
chdir*h�"
command*h�"
compatible_withh�"
copy_data_to_bin*truehp"�
data2*//project:node_modules/html-webpack-plugin2$//project:node_modules/webpack-merge2+//project:node_modules/webpack-stats-plugin2//project/configs:package_json2#//project/configs:webpack.config.js2)//project/configs:webpack.bazel.plugin.js2//project/public:public2//project/src:src2&//project:dev_server.webpack.config.js2'//project/configs:webpack.dev.config.js2//project/src:App.jsh�"

deprecationh�"
enable_runfiles*truehp"J

entry_point*4@aspect_rules_js//js/private:js_devserver_entrypointh�"X
env
B

PROJECT_DIRprojectB5

NODE_OPTIONS%--es-module-specifier-resolution=nodeh"
exec_compatible_withh�"
exec_properties
h"
expect_failure*h�"
expected_exit_codeh"
featuresh�"

fixed_argsh�"1
generator_function*rh_webpack_devserverh�"6
generator_location*project/BUILD.bazel:68:18h�"#
generator_name*
dev_serverh�"0
grant_sandbox_write_permissions*falsehp"%
include_declarations*falsehp"

include_npm*falsehp"+
nclude_npm_linked_packages*truehp"*
include_transitive_sources*truehp"
    log_level*errorh�"
name*
dev_serverh�"
no_copy_to_binh�"

node_optionsh�"
node_toolchainh�"
output_licenses :
NONEh"
patch_node_fs*truehp"&
preserve_symlinks_main*truehp"
restricted_toh�"$
tags2ibazel_notify_changesh�"
target_compatible_withh�"
testonly*falsehp"<
tool_exec_cfg*$//project:_dev_server_webpack_binaryh�">
tool_target_cfg*$//project:_dev_server_webpack_binaryh�"

toolchainsh�"
             transitive_configsh�"+
nresolved_symlinks_enabled*truehp"(
use_execroot_entry_point*truehp"

visibilityh�"_
$rule_implementation_hash*@f4c1834a0f0ce314fabe486ffd039fa692515e5cefceee61e4116c8336824f0e*$//project:_dev_server_webpack_binary*&//project:dev_server.webpack.config.js**//project:node_modules/html-webpack-plugin*$//project:node_modules/webpack-merge*+//project:node_modules/webpack-stats-plugin*//project/configs:package_json*)//project/configs:webpack.bazel.plugin.js*#//project/configs:webpack.config.js*'//project/configs:webpack.dev.config.js*//project/public:public*//project/src:App.js*//project/src:src*.@aspect_rules_js//js:allow_unresolved_symlinks*$@aspect_rules_js//js:enable_runfiles*-@aspect_rules_js//js/private:js_binary.sh.tpl*4@aspect_rules_js//js/private:js_devserver_entrypoint*-@aspect_rules_js//js/private:node_wrapper.bat*,@aspect_rules_js//js/private:node_wrapper.sh*,@aspect_rules_js//js/private:npm_wrapper.bat*+@aspect_rules_js//js/private:npm_wrapper.sh*/@aspect_rules_js//js/private/node-patches:fs.js*5@aspect_rules_js//js/private/node-patches:register.js*6@aspect_rules_js//js/private/node-patches_legacy:fs.js*<@aspect_rules_js//js/private/node-patches_legacy:register.js*@platforms//os:windowsB"@6d9fafb30ca625b3dd5dfec2331abeee13a26df54a641b4020c4563be7fcdf56darwin_arm64-fastbuild
          darwin_arm64"@6d9fafb30ca625b3dd5dfec2331abeee13a26df54a641b4020c4563be7fcdf56$rule_implementation_hash*@f4c1834a0f0ce314fabe486ffd039fa692515e5cefceee61e4116c8336824f0e*$//project:_dev_server_webpack_binary*&//project:dev_server.webpack.config.js**//project:node_modules/html-webpack-plugin*$//project:node_modules/webpack-merge*+//project:node_modules/webpack-stats-plugin*//project/configs:package_json*)//project/configs:webpack.bazel.plugin.js*#//project/configs:webpack.config.js*'//project/configs:webpack.dev.config.js*//project/public:public*//project/src:App.js*//project/src:src*.@aspect_rules_js//js:allow_unresolved_symlinks*$@aspect_rules_js//js:enable_runfiles*-@aspect_rules_js//js/private:js_binary.sh.tpl*4@aspect_rules_js//js/private:js_devserver_entrypoint*-@aspect_rules_js//js/private:node_wrapper.bat*,@aspect_rules_js//js/private:node_wrapper.sh*,@aspect_rules_js//js/private:npm_wrapper.bat*+@aspect_rules_js//js/private:npm_wrapper.sh*/@aspect_rules_js//js/private/node-patches:fs.js*5@aspect_rules_js//js/private/node-patches:register.js*6@aspect_rules_js//js/private/node-patches_legacy:fs.js*<@aspect_rules_js//js/private/node-patches_legacy:register.js*@platforms//os:windowsB"@6d9fafb30ca625b3dd5dfec2331abeee13a26df54a641b4020c4563be7fcdf56darwin_arm64-fastbuild
                               darwin_arm64"@6d9fafb30ca625b3dd5dfec2331abeee13a26df54a641b4020c4563be7fcdf56
iBazel [1:01PM]: Error running Bazel proto: cannot parse invalid wire-format data
 ELIFECYCLE  Command failed with exit code 4.

We have been unable to reproduce this consistently but it does show up occasionally. @gregmagolan asked me to post here, I will provide whatever info I can.

Our ibazel config flag has these in it

# Run bazel --config=dev to choose these options:
build:dev --show_progress=false --curses=no --color=no --show_timestamps=false --ui_event_filters=-INFO,-STDERR

Version

Development (host) and target OS/architectures:

Output of bazel --version: 6.4.0

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file: rules_js - 1.38.0 rules_webpack - 0.14.0 rules_ts - 2.2.0 aspect-cli - 5.8.5 (for gazelle)

Language(s) and/or frameworks involved:

How to reproduce

Have a package with a BUILD file that contains a webpack_dev_server target.

Run that target with ibazel through pnpm with the config we provided in the bazelrc.

Beyond that, I'm not sure what triggers the error. Maybe it's related to rebasing, maybe it's related to running again and again. I'm not sure.

Any other information?

No response

Aghassi commented 6 months ago

Here is the line in ibazel that is throwing https://github.com/bazelbuild/bazel-watcher/blob/master/internal/bazel/bazel.go#L292