aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.52k stars 1.17k forks source link

--debug-port not working in SAM Local Invoke on Windows #7477

Open pedrocimp opened 2 months ago

pedrocimp commented 2 months ago

Description:

When using the sam local invoke command on Windows, the --debug-port (or -d) argument does not seem to be applied, which prevents the debugging process from starting.

Context:

I'm trying to start a debugging session with the following command:

sam local invoke myFunction--event tests\resources\events\mock-event.json --docker-network droide-common --container-host 127.0.0.1 --skip-pull-image --debug-port 9999

However, after running the command, there is no indication in the logs that the --debug-port option is being recognized. Here's a snippet from the logs:

No current session found, using default AWS::AccountId
Invoking Container created from my-local-lambda-image:latest
Building image.................
Requested to skip pulling images ...

START RequestId: a0c7a971-babc-4c91-92e4-caf36c600d06 Version: $LATEST
END RequestId

Expected behavior:

The specified debug port should be opened and ready to accept a debugging connection, but this doesn't seem to happen.

Environment:

Steps to reproduce:

  1. Run the following command on Windows:

    sam local invoke GetActifByNumeroMr --event tests\resources\events\mock-event.json --docker-network droide-common --container-host 127.0.0.1 --skip-pull-image --debug-port 9999
  2. Check the logs, which do not show any indication that the --debug-port argument is recognized.

Possible suggestions or fixes:

Thank you for your assistance!

aaythapa commented 2 months ago

Thanks for opening this, looks like a SAM CLI issue so transferring over to them

sidhujus commented 1 month ago

Hi, could you please provide the runtime your lambda function is using? I tried to reproduce the issue with node18 and couldn't get the same error

pedrocimp commented 1 month ago

Hi, the runtime is node20 on windows. Could you try and tell me if you can reproduce ?

pedrocimp commented 1 week ago

@aaythapa @sidhujus any news ?