app:pack aborts when Node writes process warnings to api-mesh stderr
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- cli
Hướng nghiên cứu
Bắt đầu tại src/commands/app/pack.js, xung quanh lệnh gọi aio api-mesh get --json, và đọc các test liên quan trong test/commands/app/pack.test.js. Giữ nguyên việc phát hiện trường hợp stderr no-mesh đồng thời xử lý các cảnh báo của tiến trình Node, và xác minh rằng việc thiếu thông báo lỗi không còn che khuất lỗi ban đầu. Chạy các test pack tập trung và xác nhận rằng việc tra cứu mesh thành công tiếp tục trên Node 22.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
app:pack treats any output on the aio api-mesh get --json child process' stderr as a fatal error:
https://github.com/adobe/aio-cli-plugin-app/blob/master/src/commands/app/pack.js#L198-L202
const { stdout, stderr } = await execa('aio', ['api-mesh', 'get', '--json'], { cwd: process.cwd() })
if (stderr) {
throw new Error(stderr)
}
Node process warnings are written to stderr while the command still exits 0. On Node 22 the punycode deprecation (DEP0040) is emitted on essentially every aio invocation, so a successful mesh lookup aborts packaging, with the deprecation notice reported as the error.
The thrown message doesn't contain Unable to get mesh config., so it falls through the classification below and is rethrown, failing the whole command.
Steps to reproduce
- Node 22 (
v22.22.2here),@adobe/aio-cli11.1.2,@adobe/aio-cli-plugin-app14.8.1,@adobe/aio-cli-plugin-api-mesh5.7.0 installed - Run
aio app:packin any App Builder project
- Getting api-mesh config...
✖ Command failed with exit code 1: aio api-mesh get --json
(node:42333) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
› Error: Command failed with exit code 1: aio api-mesh get --json
Confirming the warning goes to stderr on an otherwise clean run:
$ aio api-mesh get --json 2>/tmp/err.txt >/tmp/out.txt ; cat /tmp/err.txt
(node:25694) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Expected behaviour
Node process warnings on the child's stderr should not be interpreted as an api-mesh failure.
Note on the stderr check
The if (stderr) throw is not redundant and shouldn't simply be dropped — it is how the "no mesh" case is detected. api-mesh:get reports that via this.error(msg, { exit: false }), which writes to stderr and exits 0, so execa resolves:
https://github.com/adobe/aio-cli-plugin-api-mesh/blob/main/src/commands/api-mesh/get.js
The fix therefore needs to keep the check but exclude Node process warnings from it.
Secondary bug in the same block
if (err?.message.includes('Error: Unable to get mesh config.')) {
The optional chaining stops one level short. If a thrown value has no message — a non-Error throw, or an execa error carrying output only on stderr — this raises TypeError: Cannot read properties of undefined (reading 'includes') inside the catch, masking the original failure. This is currently asserted as expected behaviour in test/commands/app/pack.test.js:
await expect(command.createDeployYamlFile(extConfig)).rejects.toEqual(TypeError('Cannot read properties of undefined (reading \'includes\')'))
Environment
| OS | Linux 5.15 (Ubuntu) |
| Node | v22.22.2 |
@adobe/aio-cli |
11.1.2 |
@adobe/aio-cli-plugin-app |
14.8.1 |
@adobe/aio-cli-plugin-api-mesh |
5.7.0 |
I have a fix ready and will open a PR referencing this issue.
- Ngôn ngữ chính
- JavaScript
- Star
- 28
- Fork
- 41
- Merge trung bình
- 5 giờ 54 phút
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 adobe/aio-cli-plugin-app
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
adobe/aio-cli-plugin-app#924 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
adobe/aio-cli-plugin-app#919 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
adobe/aio-cli-plugin-app#890 ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
adobe/aio-cli-plugin-app#881 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
adobe/aio-cli-plugin-app#877 · 1 bình luận ·
Tất cả issue của adobe/aio-cli-plugin-app
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
subhranshudash13-dotcom/Contribo#74 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
ThatGuySam/doesitarm#1114 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
laaielichter/Reverseport#44 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
failed for an unknown reason
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
OpenTermsArchive/contrib-declarations#4148 ·
Maintainer thường phản hồi trong vòng 1 ngày