Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step-through debugging in VSCode with Postman #3519

Open
brandon-burciaga opened this issue Jun 4, 2023 · 4 comments
Open

Step-through debugging in VSCode with Postman #3519

brandon-burciaga opened this issue Jun 4, 2023 · 4 comments
Labels
feature-request New feature or enhancement. May require GitHub community feedback. guidance General information and guidance, answers to FAQs, or recommended best practices/resources. lambda sam service:apigateway

Comments

@brandon-burciaga
Copy link

System details (run the AWS: About Toolkit command)

OS: Linux x64 5.10.16.3-microsoft-standard-WSL2
Visual Studio Code extension host: 1.78.2
AWS Toolkit: 1.72.0
node: 16.17.1

Question

So I understand I can invoke Lambdas locally in various ways. All of these ways consist of sending a payload and the debugging session only lasts for one request cycle.

I'd love to be able to start the APIG instance with sam local start-api and be able to step-through debug while hitting the API from Postman.

It seems this just isn't possible?

I have tried using a combination of sam local start-api -d 5858 and configuring my VSCode launch.json to attach to port 5858, however this does not work as expected.

Any advice or guidance here? With Azure Functions, I can just press F5 and everything works as expected...

@brandon-burciaga brandon-burciaga added the guidance General information and guidance, answers to FAQs, or recommended best practices/resources. label Jun 4, 2023
@justinmk3
Copy link
Contributor

justinmk3 commented Jun 5, 2023

This is definitely something we want to enable! Does #2535 match what you expect?

With Azure Functions, I can just press F5 and everything works as expected...

Meaning, it opens a port? Or does Azure Functions extension do something specific with postman?

@justinmk3 justinmk3 added sam feature-request New feature or enhancement. May require GitHub community feedback. lambda service:apigateway labels Jun 5, 2023
@brandon-burciaga
Copy link
Author

@justinmk3 yes this is exactly what I am looking for. To be able to use sam local start-api to launch a sustained/running instance of the local API, and attach the VSCode debugger to it. Then I can make Postman or cURL requests ad hoc while the SAM server continues to run/host the API. I would be fine with either having to run sam local start-api in a terminal, and then starting the debugger, or having the debugger itself start the api.

Everything for Lambdas seem to just execute the function once, then the debugger stops. It would be great to be able to ad-hoc requests like I mentioned.

As for Azure, it does open a port and list the endpoints available at localhost. It doesn't do anything with Postman, I am just using that as an example since our APIs are in Postman. cURL could be used as an example instead.

Here is an example Azure Function launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach to Node Functions",
      "type": "node",
      "request": "attach",
      "port": 9230,
      "preLaunchTask": "func: host start"
    }
  ]
}

I am wanting to be able to do something similar with my Lambdas.

@scottattern
Copy link

@justinmk3 - this is exactly what we need if we can get an ETA or workaround

@brandon-burciaga
Copy link
Author

@justinmk3 do you have any ideas where to start with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or enhancement. May require GitHub community feedback. guidance General information and guidance, answers to FAQs, or recommended best practices/resources. lambda sam service:apigateway
Projects
None yet
Development

No branches or pull requests

3 participants