-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging Lambdas with a Layer (Or alternative) #5045
Comments
Lambda layers are currently not well-supported: https://github.com/aws/aws-toolkit-vscode/issues?q=is%3Aissue+is%3Aopen+layer+image The recommended alternative is to use Lambda with packagetype=image https://docs.aws.amazon.com/lambda/latest/dg/images-create.html . This allows you to define a Dockerfile that defines your Lambda environment. This essentially replaces Lambda "layers", so we don't have plans to add explicit support for layers to AWS Toolkit. |
Hello, example of my working lambda launch.json with this workaround:
|
System details
Question
How can I debug Lambdas which will have a lambda layer attached using AWS SAM without including all dependencies in the
requirements.txt
?We have a repo which contains a series of about 15 services and the code for their associated lambdas. Each lambda has an associated
requirements.txt
which is used by a build job to package the code and upload to S3.We have a few instances where we're using lambda layers to include dependencies which aren't available through pip or simply to reduce the size of the deployment package, however I'm struggling to create a launch configuration for these functions which includes all the necessary dependancies during testing.
I've tried using a preLaunchTask to temporarily add the layer dependencies to requirements.txt, and a postDebugTask to clean these up, however I couldn't get the postDebugTask to run (I think it must run in a different context as it can never be found despite being in my tasks.json).
I've also looked into using a custom template for the invokeTarget, however this approach seems to lack the full debugging functionality with VSCode (Breakpoints etc).
I think a separate
prod-requirements.txt
might work for the instances where we aim to minimise the package size, but wouldn't solve the issue of including binaries which aren't in pip such as git-lambda-layer.Does anyone have any guidance on how we might be able to approach this, whilst managing the configuration for about 30 lambdas in a single repository.
I'm happy to provide more context if needed.
Sample from
launch.json
:Sample of File Structure:
The text was updated successfully, but these errors were encountered: