Troubleshooting serverless applications - AWS Toolkit for VS Code

Troubleshooting serverless applications

This topic details common errors that you might encounter when creating serverless applications with the Toolkit for VS Code and how to resolve them.

How can I use a samconfig.toml with a SAM launch configuration?

Specify the location of your SAM CLI samconfig.toml by configuring the --config-file argument in the sam.localArguments property of your launch configuration. For example, if the samconfig.toml file is located at the top level of your workspace:

"sam": { "localArguments": ["--config-file", "${workspaceFolder}/samconfig.toml"], }

Error: "RuntimeError: Container does not exist"

The sam build command can show this error if your system does not have enough disk space for the Docker container. If your system storage has only 1-2 GB of space available, sam build might fail during processing, even if system storage is not completely full before the build starts. For more information, see this GitHub issue.

Error: "docker.errors.APIError: 500 Server Error ... You have reached your pull rate limit."

Docker Hub limits requests that anonymous users can make. If your system reaches the limit, Docker fails and this error appears in the OUTPUT view of VS Code:

docker.errors.APIError: 500 Server Error: Internal Server Error ("toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit")

Ensure that your system Docker service has authenticated with your Docker Hub credentials.

Error: "500 Server Error: Mounting C:\Users\..."

Windows users might see this Docker mounting error when debugging AWS SAM applications:

Fetching lambci/lambda:nodejs10.x Docker container image...... 2019-07-12 13:36:58 Mounting C:\Users\<username>\AppData\Local\Temp\ ... as /var/task:ro,delegated inside runtime container Traceback (most recent call last): ... requests.exceptions.HTTPError: 500 Server Error: Internal Server Error ...

Try refreshing the credentials for your shared drives (in the Docker settings).

Using WSL, webviews (for example, the "Invoke on AWS" form) are broken

This is a known VS Code issue for users of Cisco VPN. For more information, see this GitHub issue.

A workaround is suggested in this WSL tracking issue.

Debugging a TypeScript application, but breakpoints are not working

This will happen if there isn't a source map to link the compiled JavaScript file to the source TypeScript file. To correct this, open your tsconfig.json file and ensure the following option and value are set: "inlineSourceMap": true.