Replies: 5 comments 1 reply
-
Here is serverless.yaml file. org: ericjung
app: aws-node-http-api-project
service: aws-node-http-api-project
frameworkVersion: '3'
provider:
name: aws
runtime: nodejs14.x
functions:
hello:
handler: handler.hello
events:
- httpApi:
path: /
method: get
plugins:
- serverless-offline
- serverless-plugin-typescript
custom:
serverless-offline:
resourceRoutes: true
Here is launch.json file in vscode setting. {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Hello World",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceRoot}/node_modules/.bin/sls",
"args": [
"invoke",
"local",
"--function",
"hello",
"--data",
"{}",
]
}
]
} |
Beta Was this translation helpful? Give feedback.
-
your args in the launch config are running you might find additional ideas here: https://github.com/dherault/serverless-offline#debug-process |
Beta Was this translation helpful? Give feedback.
-
@dnalborczyk {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug serverless app",
"program": "${workspaceFolder}/node_modules/serverless/bin/serverless",
"args": [
"offline",
"--httpPort",
"4001",
],
"runtimeExecutable": "node"
}
]
} org: ericjung
app: aws-node-http-api-project
service: aws-node-http-api-project
frameworkVersion: '3'
provider:
name: aws
runtime: nodejs14.x
functions:
hello:
handler: handler.hello
events:
- httpApi:
path: /hello
method: get
plugins:
- serverless-offline
- serverless-plugin-typescript
custom:
serverless-offline:
httpPort: 3005
|
Beta Was this translation helpful? Give feedback.
-
I success debugging in TypeScript.
|
Beta Was this translation helpful? Give feedback.
-
I can achieve this by attaching the subprocess of the NOTE: I'm using Linux OS, if you are using Windows you must have to do changes in the commands.
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "serverless: Run offline",
"command": "npm run build; sls offline -s dev -t --debug '*' --param='procname=diginteg-data-source-service'",
"problemMatcher": []
}
]
}
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "Serverless",
"request": "attach",
"processId": "${input:serverlessFindNodePID}",
"sourceMaps": true,
"outFiles": [ "${workspaceFolder}/dist/**/*.js" ],
}
],
"inputs": [
{
"id": "serverlessFindNodePID",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "pgrep -f 'sf-core.js.*procname=diginteg-data-source-service'",
"description": "Compatible PIDs",
"useFirstResult": true,
}
}
]
} And that's it!! happy debugging. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I learned debugging in JavaScript.
But i failed debugging in TypeScript.
Show me debugging solution in TypeScript.
Beta Was this translation helpful? Give feedback.
All reactions