Skip to content

nodejs_image build issue #3357

@trammel-may

Description

@trammel-may

🐞 bug report

Affected Rule

The issue is caused by the rule:

nodejs_image

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

This worked in previous versions

http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "f0f76a06fd6c10e8fb9a6cb9389fa7d5816dbecd9b1685063f89fb20dc6822f3",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.5.1/rules_nodejs-4.5.1.tar.gz"],
)

http_archive(
    name = "io_bazel_rules_docker",
    sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
    strip_prefix = "rules_docker-0.22.0",
    urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.22.0/rules_docker-v0.22.0.tar.gz"],
)

Description

This configuration will result in a build where the image layer contains the incorrect node_tool_path. This results in an error (see below) when attempting to run the nodejs_image.

The expected node_tool_path

readonly node_tool_path="nodejs_linux_amd64/bin/nodejs/bin/node"

The actual node_tool_path

readonly node_tool_path="nodejs_darwin_amd64/bin/nodejs/bin/node"

🔬 Minimal Reproduction

A minimal reproduction has been attached. Please unzip the attached zipfile, cd into the project directory and run make.

🔥 Exception or Error


WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
/app/packages/example/example: line 190: /app/packages/example/example.runfiles/nodejs_darwin_amd64/bin/nodejs/bin/node: cannot execute binary file: Exec format error
make: *** [image] Error 126

🌍 Your Environment

Operating System:

  
macOS Monterey
Version 12.1
Mac mini (M1, 2020)
  

Output of bazel version:

  
Bazelisk version: v1.9.0
Build label: 4.2.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Aug 18 12:54:03 2021 (1629291243)
Build timestamp: 1629291243
Build timestamp as int: 1629291243
  

Rules_nodejs version:

(Please check that you have matching versions between WORKSPACE file and @bazel/* npm packages.)

Anything else relevant?
nodejs_image_issue.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions