Amazon SAM CLI troubleshooting
This section provides details on how to troubleshoot error messages when using, installing, and managing the Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI).
Troubleshooting
For troubleshooting guidance related to Amazon SAM CLI, see Troubleshooting installation errors.
Error messages
Curl error: "curl: (6) Could not resolve: ..."
When trying to invoke the API Gateway endpoint, you see the following error:
curl: (6) Could not resolve: endpointdomain (Domain name not found)
			This means that you've attempted to send a request to a domain that's not valid. This can happen if your serverless application failed to deploy successfully, or if you have a typo in your curl command. Verify that the application deployed successfully by using the Amazon CloudFormation console or the Amazon CLI, and verify that your curl command is correct.
Error: Can’t find exact resource information with given stack name
When running the sam remote invoke command on an application that contains
				a single Lambda function resource, you see the following error:
Error: Can't find exact resource information with given <stack-name>. Please provide full resource ARN or --stack-name to resolve the ambiguity.
			- Possible cause: You didn’t provide the --stack-nameoption.
- 
						If a function ARN is not provided as an argument, the sam remote invokecommand requires that the--stack-nameoption is provided.
- Solution: Provide the --stack-nameoption.
- 
						The following is an example: $sam remote invoke --stack-nameInvoking Lambda Function HelloWorldFunction START RequestId: 40593abb-e1ad-4d99-87bd-ac032e364e82 Version: $LATEST END RequestId: 40593abb-e1ad-4d99-87bd-ac032e364e82 REPORT RequestId: 40593abb-e1ad-4d99-87bd-ac032e364e82 Duration: 11.31 ms Billed Duration: 12 ms Memory Size: 128 MB Max Memory Used: 67 MB Init Duration: 171.71 ms {"statusCode":200,"body":"{\"message\":\"hello world\"}"}%sam-app
Error: Can’t find resource information from stack name
When running the sam remote invoke command and passing a Lambda function ARN
				as an argument, you see the following error:
Error: Can't find resource information from stack name (<stack-name>) and resource id (<function-id>)
- Possible cause: You have the stack name value defined in your
							samconfig.tomlfile.
- 
						The Amazon SAM CLI first checks your samconfig.tomlfile for a stack name. If specified, the argument is passed as a logical ID value.
- Solution: Pass the function’s logical ID instead.
- 
						You can pass the function’s logical ID as an argument instead of the function’s ARN. 
- Solution: Remove the stack name value from your configuration file.
- 
						You can remove the stack name value from your configuration file. This prevents the Amazon SAM CLI from passing your function ARN as a logical ID value. Run sam buildafter modifying your configuration file.
Error: Failed to create managed resources: Unable to locate credentials
When running the sam deploy command, you see the following error:
Error: Failed to create managed resources: Unable to locate credentials
This means that you have not set up Amazon credentials to enable the Amazon SAM CLI to make Amazon service calls. To fix this, you must set up Amazon credentials. For more information, see Setting up Amazon credentials.
Error: FileNotFoundError in Windows
When running commands in Amazon SAM CLI on Windows, you may see the following error:
Error: FileNotFoundError
Possible cause: The Amazon SAM CLI might interact with filepaths that exceed the Windows max path limitation.
Solution: To resolve this issue, the new long paths behavior must enabled. To do this, see Enable Long Paths in Windows 10, Version 1607, and Later
Error: pip's dependency resolver ...
Example error text:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. aws-sam-cli 1.58.0 requires aws-sam-translator==1.51.0, but you have aws-sam-translator 1.58.0 which is incompatible. aws-sam-cli 1.58.0 requires typing-extensions==3.10.0.0, but you have typing-extensions 4.4.0 which is incompatible.
- Possible cause: If you use pip to install packages, dependencies between packages may conflict.
- 
						Each version of the aws-sam-clipackage depends on a version of theaws-sam-translatorpackage. For example,aws-sam-cliv1.58.0 may depend onaws-sam-translatorv1.51.0.If you install the Amazon SAM CLI using pip, then install another package which depends on a newer version of aws-sam-translator, the following will occur:- 
								The newer version of aws-sam-translatorwill install.
- 
								The current version of aws-sam-cliand the newer version ofaws-sam-translatormay not be compatible.
- 
								When you use the Amazon SAM CLI, the dependency resolver error will occur. 
 Solutions:- 
								Use the Amazon SAM CLI native package installer. - 
										Uninstall the Amazon SAM CLI using pip. For instructions, see Uninstalling the Amazon SAM CLI. 
- 
										Install the Amazon SAM CLI using the native package installer. For instructions, see Install the Amazon SAM CLI. 
- 
										When necessary, upgrade the Amazon SAM CLI using the native package installer. For instructions, see Upgrading the Amazon SAM CLI. 
 
- 
										
- 
								If you must use pip, we recommend that you install the Amazon SAM CLI into a virtual environment. This ensures a clean installation environment and an isolated environment if errors occur. For instructions, see Installing the Amazon SAM CLI into a virtual environment using pip. 
 
- 
								
Error: No such command ‘remote’
When running the sam remote invoke command, you see the following
				error:
$sam remote invoke2023-06-20 08:15:07 Command remote not available Usage: sam [OPTIONS] COMMAND [ARGS]... Try 'sam -h' for help. Error: No such command 'remote'....
- Possible cause: Your version of the Amazon SAM CLI is out of date.
- 
						The Amazon SAM CLI sam remote invokecommand was released with Amazon SAM CLI version 1.88.0. You can check your version by running thesam --versioncommand.
- Solution: Upgrade your Amazon SAM CLI to the latest version.
- 
						For instructions, see Upgrading the Amazon SAM CLI. 
Error: Running Amazon SAM projects locally requires Docker. Have you got it installed?
When running the sam local start-api command, you see the following error:
Error: Running Amazon SAM projects locally requires Docker. Have you got it installed?
This means that you do not have Docker properly installed. Docker is required to test your application locally. To fix this, follow the instructions for installing Docker for your development host. For more information, see Installing Docker.
Error: Security Constraints Not Satisfied
When running sam deploy --guided, you're prompted with the question
						Function may not have authorization defined, Is this
					okay? [y/N]N (the
				default response), you see the following error:
Error: Security Constraints Not Satisfied
The prompt is informing you that the application you're about to deploy might have a
				publicly accessible Amazon API Gateway API configured without authorization. By responding
					N to this prompt, you're saying that this is not OK.
To fix this, you have the following options:
- 
					Configure your application with authorization. For information about configuring authorization, see Control API access with your Amazon SAM template. 
- 
					If your intention is to have a publicly accessible API endpoint without authorization, restart your deployment and respond to this question with Yto indicate that you're OK with deploying.
message: Missing Authentication Token
When trying to invoke the API Gateway endpoint, you see the following error:
{"message":"Missing Authentication Token"}
			This means that you've attempted to send a request to the correct domain, but the URI isn't recognizable. To fix this, verify the full URL, and update the curl command with the correct URL.
Warning messages
Warning: ... Amazon will no longer maintain the Homebrew installer for Amazon SAM ...
When installing the Amazon SAM CLI using Homebrew, you see the following warning message:
Warning: ... Amazon will no longer maintain the Homebrew installer for Amazon SAM (aws/tap/aws-sam-cli). For AWS supported installations, use the first party installers ...
- Potential cause: Amazon no longer maintaining Homebrew support.
- 
						Starting September 2023, Amazon will no longer maintain the Homebrew installer for the Amazon SAM CLI. Solution: Use an Amazon supported installation method.- 
								You can find Amazon supported installation methods at Install the Amazon SAM CLI. 
 Solution: To continue using Homebrew, use the community managed installer.- 
								You can use the community managed Homebrew installer at your discretion. For instructions, see Managing the Amazon SAM CLI with Homebrew. 
 
-