aws-samples / aws-samples/aws-lambda-extensions

Unable to debug with SAM local invoke in Node.js example

Đang mở
#66 7 bình luận 7 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Go
Star
488
Fork
144
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi all,
in nodejs-example-extension example for Node.js platform something during registration phase brakes the debugger when runs locally on VS Code using sam local invoke --port 6767 ... on a Lambda that includes this layer.
The following is a snap of the debug logs when launched from VS Code:

START RequestId: 05da599b-f76d-494e-905b-bead9860f186 Version: $LATEST
nodejs-example-extension  launching extension
Debugger listening on ws://0.0.0.0:6767/95282789-af6d-4c40-b544-b1d70e0650c2
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
hello from extension
register
extensionId 0e16eae5-5e84-4b22-a204-c54424793f69
next
Starting inspector on 0.0.0.0:6767 failed: address already in use
invoke
next
...

notice the Starting inspector on 0.0.0.0:6767 failed: address already in use error line in logs, after that all set breakpoints are ignored and it's impossible to debug every Lambdas.

this is the VS Code debug task setup:

{
        "name": "lambda_with_example_layer",
        "type": "pwa-node",
        "request": "attach",
        "address": "localhost",
        "port": 6767,
        "localRoot": "${workspaceFolder}/lambda_with_example_layer",
        "sourceMaps": true,
        "remoteRoot": "/var/task",
        "protocol": "inspector",
        "stopOnEntry": false,
        "skipFiles": [
          "<node_internals>/**"
        ]
}

Is there any debugger/SAM/Docker configuration that i missed? Or is something else deeper in the layer execution flows that broke debugging in a container with SAM local?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với ví dụ nodejs-example-extension và tái tạo cấu hình attach của VS Code bằng sam local invoke --port 6767. Đọc các log trong giai đoạn đăng ký xung quanh register, next và quá trình khởi động inspector, sau đó xác định lý do inspector báo rằng cổng 6767 đã được sử dụng. Hoàn thành khi các lần invoke cục bộ attach thành công và các breakpoint được tôn trọng đối với Lambda.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.