Debugging
Debug your Alchemy infrastructure and application code directly in VSCode with full breakpoint support and step-through debugging.
As part of this guide, we’ll:
- Install the required VSCode extensions for debugging
- Configure VSCode tasks to run Alchemy with debugging enabled
- Set up launch configurations to attach the debugger automatically
-
Install VSCode Extensions
Install the bun extension for VSCode and the Command Variable extension.
-
Configure VSCode Tasks
Create a file in
.vscode/tasks.json
with the following content:{"version": "2.0.0","tasks": [{"label": "alchemy-dev","type": "shell","command": "bun","args": ["alchemy", "dev", "--inspect-wait"],"isBackground": true,"problemMatcher": {"pattern": {"regexp": "^$"},"background": {"activeOnStart": true,"beginsPattern": ".*","endsPattern": "Waiting for inspector to connect.*"}}}]} -
Configure VSCode Launch
Create a file in
.vscode/launch.json
with the following content:{"version": "0.2.0","configurations": [{"name": "Debug Alchemy Dev","type": "bun","request": "attach","url": "${input:debugUrl}","stopOnEntry": false,"preLaunchTask": "alchemy-dev"},],"inputs": [{"id": "debugUrl","type": "command","command": "extension.commandvariable.file.content","args": {"fileName": "${workspaceFolder}/.alchemy/.debugger-urls","key": "alchemy.run.ts",}}]}