Skip to content

nodejs toolchain resolution fails on M1 with rules_nodejs >= 5.6.0 #2197

@mattsoulanille

Description

@mattsoulanille

🐞 bug report

Affected Rule

The issue is caused by the rule: container_deps() WORKSPACE rule.

Is this a regression?

I don't think so. I tried some earlier versions, including 0.20.0 (with repo mapping @nodejs to @nodejs_host), but the error persisted. My guess is this was caused by a change rules_nodejs made that rules_docker may need to adapt to. However, the breakage is between minor versions of rules_nodejs, so this may be a regression on their side. I'm happy to create an issue there if necessary, and I'll see if I can find the cause by looking at the difference between 5.5.4 and 5.6.0.

Description

When using rules_nodejs >= 5.6.0 on an Apple Silicon mac with rules_docker, running container_deps() in the WORKSPACE file to set up rules_docker's deps results in the @rules_nodejs//nodejs:toolchain_type toolchain not being resolved by rules like nodejs_binary.

🔬 Minimal Reproduction

https://github.com/mattsoulanille/docker_rules_nodejs_issue

🔥 Exception or Error


% bazel run :index_bin --toolchain_resolution_debug='nodejs' --define=VERBOSE_LOGS=1
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_amd64//:node_toolchain; mismatching values: linux, x86_64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_amd64//:node_toolchain; mismatching values: linux, x86_64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_arm64//:node_toolchain; mismatching values: linux, arm64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_arm64//:node_toolchain; mismatching values: linux, arm64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_s390x//:node_toolchain; mismatching values: linux, s390x
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_s390x//:node_toolchain; mismatching values: linux, s390x
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_ppc64le//:node_toolchain; mismatching values: linux, ppc
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_linux_ppc64le//:node_toolchain; mismatching values: linux, ppc
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_amd64//:node_toolchain; mismatching values: x86_64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_amd64//:node_toolchain; mismatching values: x86_64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_arm64//:node_toolchain; mismatching values: arm64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_darwin_arm64//:node_toolchain; mismatching values: arm64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @nodejs_windows_amd64//:node_toolchain; mismatching values: windows, x86_64
INFO: ToolchainResolution:     Type @rules_nodejs//nodejs:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @nodejs_windows_amd64//:node_toolchain; mismatching values: windows, x86_64
INFO: ToolchainResolution:   Type @rules_nodejs//nodejs:toolchain_type: target platform @local_config_platform//:host: No toolchains found.
ERROR: /Users/matthew/Projects/docker_rules_nodejs_issue/BUILD.bazel:3:14: While resolving toolchains for target //:index_bin: no matching toolchains found for types @rules_nodejs//nodejs:toolchain_type
ERROR: Analysis of target '//:index_bin' failed; build aborted: 
INFO: Elapsed time: 0.272s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (38 packages loaded, 259 targets configured)
FAILED: Build did NOT complete successfully (38 packages loaded, 259 targets configured)

🌍 Your Environment

Operating System:

  
MacOS 12.5 Apple Silicon
  

Output of bazel version:

  
bazel 5.4.0
  

Rules_docker version:

  
0.25.0
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Can Close?Will close in 30 days unless there is a comment indicating why not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions