# Debuging Serverless with VS code

**URL:** <https://forum.serverless.com/t/debuging-serverless-with-vs-code/2417>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [August 4, 2017, 8:22am UTC](https://forum.serverless.com/t/debuging-serverless-with-vs-code/2417 "2017-08-04T08:22:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wellaya](https://avatars.discourse-cdn.com/v4/letter/w/3be4f8/32.png) [@wellaya](https://forum.serverless.com/u/wellaya)\
**Post date:** [August 4, 2017, 8:22am UTC](https://forum.serverless.com/t/debuging-serverless-with-vs-code/2417/1 "2017-08-04T08:22:10Z")

</div>

> <https://stackoverflow.com/questions/45437205/cannot-debug-serverless-application-in-visual-studio-code>

can anyone give a solution

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [August 5, 2017, 12:29pm UTC](https://forum.serverless.com/t/debuging-serverless-with-vs-code/2417/2 "2017-08-05T12:29:40Z")

</div>

I’ve replied to your Stack Overflow post. Hopefully that will help you.

---

<div class="post-metadata">

**Author:** ![parifuture](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@parifuture](https://forum.serverless.com/u/parifuture)\
**Post date:** [November 19, 2018, 10:23pm UTC](https://forum.serverless.com/t/debuging-serverless-with-vs-code/2417/3 "2018-11-19T22:23:22Z")

</div>

Hi @buggy  
How do I pass the params for a API endpoint? for example I have an endpoint:

`http://localhost:3000/v2/user/login`

which takes body of username password

```
{
	"username" : {{admin_username}},
	"password" : {{admin_password}}
}

```

but when I am using the data arg in vs-code

```
{
            "type": "node",
            "request": "launch",
            "name": "Launch Serverless Offline",
            "program": "${workspaceRoot}/node_modules/.bin/sls",
            "args": [
                "invoke",
                "local",
                "-f",
                "manageUser",
                "--data",
                "{\"username\" : \"admin\", \"password\" : \"apasswordhaha\"}"
            ]
        }

```

the event object get the value  
`{\"username\" : \"admin\", \"password\" : \"apasswordhaha\"}`

when calling the endpoint thru postman, I get the value of event object as  
`"body":"{\n\t\"username\" : admin,\n\t\"password\" : apasswordhaha\n}"`

Is there a way that I can pass the param in vscode in the same fashion as postman? Any help is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [November 20, 2018, 11:12am UTC](https://forum.serverless.com/t/debuging-serverless-with-vs-code/2417/4 "2018-11-20T11:12:35Z")

</div>

> [@parifuture](#):
>
> Is there a way that I can pass the param in vscode in the same fashion as postman?

When you’re using postman you’re sending a request to the API Gateway, not Lambda. The API Gateway then creates an event which is used when invoking Lambda. Without the API Gateway you just need to generate that event yourself. If the only attribute you’re accessing from the event is the body then you’ll need to pass something like:

```auto
"{\"body\":\"{\\\"username\\\":\\\"admin\\\",\\\"password\\\":\\\"apasswordhaha\\\"}\"}"

```

---

<div class="post-metadata">

**Author:** ![parifuture](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@parifuture](https://forum.serverless.com/u/parifuture)\
**Post date:** [November 20, 2018, 4:16pm UTC](https://forum.serverless.com/t/debuging-serverless-with-vs-code/2417/5 "2018-11-20T16:16:49Z")

</div>

wow that worked like a charm! Thank you @buggy
