1 . Ensure the dev
script at services/api/package.json
includes the following:
node --inspect=0.0.0.0:9229
2 . Update docker-compose.yml
to map the dist
folder and expose the 9229
port:
api:image: ${IMAGE_REPO:-lagoon}/apicommand: yarn run devvolumes:- ./services/api/src:/app/services/api/src- ./services/api/dist:/app/services/api/distdepends_on:- api-db- local-api-data-watcher-pusher- keycloakports:- '3000:3000'- '9229:9229'
3 . Add the following to .vscode/launch.json
:
{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387."version": "0.2.0","configurations": [{"name": "Docker: Attach to Node","type": "node","request": "attach","port": 9229,"address": "localhost","outFiles": ["${workspaceRoot}/app/services/api/dist/**/*.js"],"localRoot": "${workspaceFolder}/services/api","remoteRoot": "/app/services/api","sourceMaps": true,"protocol": "inspector"}]}
4 . Rebuild/restart the containers:
rm build/api && make build/api && docker-compose restart api
5 . Restart VScode.