L
L
Lagoon
Search…
API Debugging
How to debug Lagoon in VSCode.
1 . Ensure the dev script at services/api/package.json includes the following:
1
node --inspect=0.0.0.0:9229
Copied!
2 . Update docker-compose.yml to map the dist folder and expose the 9229 port:
1
api:
2
image: ${IMAGE_REPO:-lagoon}/api
3
command: yarn run dev
4
volumes:
5
- ./services/api/src:/app/services/api/src
6
- ./services/api/dist:/app/services/api/dist
7
depends_on:
8
- api-db
9
- local-api-data-watcher-pusher
10
- keycloak
11
ports:
12
- '3000:3000'
13
- '9229:9229'
Copied!
3 . Add the following to .vscode/launch.json:
1
{
2
// Use IntelliSense to learn about possible attributes.
3
// Hover to view descriptions of existing attributes.
4
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387.
5
"version": "0.2.0",
6
"configurations": [
7
{
8
"name": "Docker: Attach to Node",
9
"type": "node",
10
"request": "attach",
11
"port": 9229,
12
"address": "localhost",
13
"outFiles": ["${workspaceRoot}/app/services/api/dist/**/*.js"],
14
"localRoot": "${workspaceFolder}/services/api",
15
"remoteRoot": "/app/services/api",
16
"sourceMaps": true,
17
"protocol": "inspector"
18
}
19
]
20
}
Copied!
4 . Rebuild/restart the containers:
1
rm build/api && make build/api && docker-compose restart api
Copied!
5 . Restart VScode.
Last modified 6mo ago
Copy link