Open JumaBok opened 2 years ago
Thanks @JumaBok for raising this feature request.
Is there a workaround for this?
We have this issue too.
Having the same issue.
Would love to know a solution for this as well
Having the same issue
@eternal-eager-beaver @Ugikie @ffMathy @orrenbizz @JumaBok I have spent countless hours debugging why debugging was not working when I first faced this issue and wanted to update this issue with my workaround. It is a little bit ugly/fragile but it works.
I worked around this limitations using some scripting magic in vscodeslaunch.json
& tasks.json
and slightly modifying the tsconfig.json
and enabling the sourcemap option in the SAM template.
.vscode/launch.json
code:HelloWorldFunction
was added. This configuration:
target: "code"
), specifying the lambda handler (lambdaHandler: "app.lambdaHandler"
) and the project root.x86_64
and specifies the runtime as nodejs20.x
, ensuring compatibility with the latest Node.js features and performance improvements.Watch All
), likely set up to compile TypeScript to JavaScript and watch for changes, ensuring that the latest code is always deployed and debugged..gitignore
build/
and **aws-toolkit-tsconfig.json
, preventing build artifacts and specific configuration files from being tracked by Git. This keeps the repository clean and avoids potential conflicts or discrepancies caused by environment-specific files.tasks.json
in .vscode/
npm install
, TypeScript compilation, and a post-compilation task were added. These tasks ensure that all dependencies are installed, the TypeScript is compiled to JavaScript, and any necessary cleanup or additional setup is performed after compilation.tsconfig.json
sourceMap
to true allows generation of source maps, which are crucial for debugging TypeScript in production environments as they map the compiled JavaScript back to the original TypeScript source code.outDir
, organizing compiled files separately from source files, which helps in clean deployments.template.yaml
Enabled Source Maps: The source map setting was enabled, allowing AWS SAM to use source maps during the build process. Ideally, I expected just doing this to handle everything automatically.
Select the code:HelloWorldFunction from the Run and Debug Menu and enjoy debugging 🎉
Describe your idea/feature/enhancement
I'm not sure if this already exists, but I can't see it readily documented. I'd like to be able to debug locally in VSCode using a launch configuration, and using the new typescript beta-features. While esbuild is emitting sourcemaps, it's dropping those into the .aws-sam/build/** folders and therefore the debug cannot locate them relative to the source code.
Is there a way for me to specify an alternative location for the sourcemaps to be emitted, or can I tell VSCode where to look? I've tried to add resolveSourceMapLocations but it doesn't recognise the option under the configuration type of aws-sam.
Thanks!