aws-sam-cli: "sam deploy" does not execute if a tag has a long value
Description:
The sam deploy command hangs if a tag with a long value (approx 30+ characters long) is provided. Tested on SAM CLI v0.43.0.
Steps to reproduce the issue:
- Create an empty directory and navigate to it.
 - Execute 
sam deploy --stack-name test --tags key=012345678901234567890123456789 
Observed result: The command hangs and does not produce any output.
Expected result:
	Deploying with following values
	===============================
	Stack name                 : test
	Region                     : None
	Confirm changeset          : False
	Deployment s3 bucket       : None
	Capabilities               : null
	Parameter overrides        : {}
Initiating deployment
=====================
Error: Failed to package template: /tmpDir/template.yml. 
 [Errno 2] No such file or directory: '/tmpDir/template.yml'
However, if a shorter tag value is provided (e.g. sam deploy --stack-name test --tags key=01234567890123456789) then the correct output gets printed.
About this issue
- Original URL
 - State: closed
 - Created 4 years ago
 - Reactions: 2
 - Comments: 21 (10 by maintainers)
 
This appears to be caused by this regex that was added in version 0.42.0: https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/cli/types.py#L207.
I isolated this code and tried it with a short tag and a long tag and it is the
re.findallcall that is hanging. Not exactly sure what the regex pattern is meant to do as it is a rather long and complex pattern. A little more commenting for that would be helpful.In my case there is no any error msg showing up. It took me a day to figure out what the problem is and it was because I was lucky to google and find this page⦠I am using 0.44.