nodejs_npm --build-in-source silently produces a dependency-less artifact for an npm workspaces monorepo
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nodejs, python
- Lĩnh vực
- build-system, devtools
Hướng nghiên cứu
Start with NodejsNpmBuilder and NodejsNpmWorkflow._actions_for_linking_source_dependencies_to_artifacts, then inspect LinkSinglePathAction.execute. Reproduce the npm workspaces build_in_source example and check how the missing packages/fn/node_modules path is handled. Done means hoisted dependencies reach the artifact or the build emits a visible warning instead of succeeding silently.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
For an npm workspaces monorepo built with --build-in-source, the NodejsNpmBuilder workflow (the plain one, not NodejsNpmEsbuildBuilder) produces an artifact with no dependencies at all, and reports success.
npm hoists the workspace package's dependencies to the monorepo root, so packages/<fn>/node_modules is never created. NodejsNpmWorkflow._actions_for_linking_source_dependencies_to_artifacts then links source_dir/node_modules into the artifacts directory, and LinkSinglePathAction.execute treats a missing source as nothing to do:
if not source_path.exists():
# Source path doesn't exist, nothing to symlink
LOG.debug("Source path %s does not exist, skipping generating symlink", source_path)
return
The result is a Lambda package that fails at invoke time with Cannot find module, with only a debug-level log at build time.
Steps to reproduce
An npm workspaces monorepo, one function per workspace package:
package.json { "workspaces": ["packages/*"] }
package-lock.json
packages/fn/package.json { "dependencies": { "minimal-request-promise": "^1.3.0" } }
packages/fn/included.js require("minimal-request-promise")
Build packages/fn in source:
LambdaBuilder(language="nodejs", dependency_manager="npm", application_framework=None).build(
source_dir, # <monorepo>/packages/fn
artifacts_dir,
scratch_dir,
os.path.join(source_dir, "package.json"),
runtime="nodejs22.x",
build_in_source=True,
)
Observed result
artifacts dir: ['included.js', 'package.json']
artifacts/node_modules: ABSENT
source packages/fn/node_modules: None <- npm hoisted, nothing to link
monorepo root node_modules: ['.package-lock.json', '@workspaces-monorepo', 'minimal-request-promise']
require.resolve from artifacts dir: UNRESOLVABLE
The build exits successfully.
Expected result
Either the hoisted dependencies reach the artifact, or the build says out loud that it could not find any — a warning rather than a debug log, so the failure surfaces at build time instead of at invoke time.
NodejsNpmEsbuildBuilder is unaffected: esbuild bundles the dependency into the output file, resolving it through the root node_modules.
Additional environment details
- aws-lambda-builders
develop(measured at 587257c) and unchanged by #931 - npm 11.19.0, node 22, Linux; the hoisting behaviour is the same on npm 8/9/10
Raised out of review on #931, which changes which npm command installs those dependencies but not where npm puts them, so the gap predates it and is not made worse by it. Filing it so the workspaces coverage added there does not imply the plain workflow's artifact is covered.
- Ngôn ngữ chính
- Python
- Star
- 381
- Fork
- 162
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/aws-lambda-builders
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws/aws-lambda-builders#925 · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 64/100
aws/aws-lambda-builders#924 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Bug: PythonUvBuilder fails to build app with dependencies on editable installs in the workspaceĐang mởstage/needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
aws/aws-lambda-builders#892 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
stage/needs-triage type/feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
aws/aws-lambda-builders#839 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area/build contributors/good-first-issue contributors/welcome type/feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
aws/aws-lambda-builders#831 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của aws/aws-lambda-builders
Issue tương tự
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
workflow: a tick's dispatch counts as 'only this step', and no review self-grants a round unattendedĐang mởworkflow
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
kristofdegrave/homeassistant-smart-charging#1505 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
New Submission: TropWATERĐang mởmetadata submission
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Wrongly named dashboard variableĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
canonical/content-cache-operator#163 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[submission]Đang mởsubmission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
leanprover/lean-eval-submissions#1852 ·
Maintainer thường phản hồi trong vòng 1 ngày