Skip to content
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

Bug: sam deploy - ValueError #6267

Closed
JeepNguy opened this issue Nov 14, 2023 · 4 comments
Closed

Bug: sam deploy - ValueError #6267

JeepNguy opened this issue Nov 14, 2023 · 4 comments
Labels
area/deploy sam deploy command blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@JeepNguy
Copy link

Description:

Executed: sam deploy --guided

Steps to reproduce:

using CloudShell

Observed result:

[cloudshell-user@ip-10-138-183-200 chimeMeeting]$ sam deploy --guided --debug
2023-11-14 21:08:47,492 | Config file location: /home/cloudshell-user/environment/chimeMeeting/samconfig.toml
2023-11-14 21:08:47,499 | Loading configuration values from [default.['deploy'].parameters] (env.command_name.section) in config file at '/home/cloudshell-user/environment/chimeMeeting/samconfig.toml'...
2023-11-14 21:08:47,513 | Configuration values successfully loaded.
2023-11-14 21:08:47,515 | Configuration values are: {'stack_name': 'chimeMeeting', 'capabilities': 'CAPABILITY_IAM', 'confirm_changeset': True, 'resolve_s3': True}
2023-11-14 21:08:47,536 | Using SAM Template at /home/cloudshell-user/environment/chimeMeeting/.aws-sam/build/template.yaml
2023-11-14 21:08:47,582 | Using config file: samconfig.toml, config environment: default
2023-11-14 21:08:47,583 | Expand command line arguments to:
2023-11-14 21:08:47,585 | --guided --template_file=/home/cloudshell-user/environment/chimeMeeting/.aws-sam/build/template.yaml --fail_on_empty_changeset --confirm_changeset --on_failure=ROLLBACK --stack_name=chimeMeeting --resolve_s3 --capabilities=['CAPABILITY_IAM']
2023-11-14 21:08:48,229 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is HelloWorldFunction
2023-11-14 21:08:48,231 | There is no customer defined id or cdk path defined for resource ApplicationResourceGroup, so we will use the resource logical id as the resource id
2023-11-14 21:08:48,233 | There is no customer defined id or cdk path defined for resource ApplicationInsightsMonitoring, so we will use the resource logical id as the resource id

Configuring SAM deploy

    Looking for config file [samconfig.toml] :  Found
    Reading default arguments  :  Success

    Setting default arguments for 'sam deploy'
    =========================================
    Stack Name [chimeMeeting]: chimeSdkWorkshop
    AWS Region [us-east-1]: us-east-1

2023-11-14 21:09:04,888 | No Parameters detected in the template
2023-11-14 21:09:04,924 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is HelloWorldFunction
2023-11-14 21:09:04,925 | There is no customer defined id or cdk path defined for resource ApplicationResourceGroup, so we will use the resource logical id as the resource id
2023-11-14 21:09:04,927 | There is no customer defined id or cdk path defined for resource ApplicationInsightsMonitoring, so we will use the resource logical id as the resource id
2023-11-14 21:09:04,929 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2023-11-14 21:09:04,932 | 0 stacks found in the template
#Shows you resources changes to be deployed and require a 'Y' to initiate deploy
Confirm changes before deploy [Y/n]: N
#SAM needs permission to be able to create roles to connect to the resources in your template
Allow SAM CLI IAM role creation [Y/n]: Y
#Preserves the state of previously provisioned resources when an operation fails
Disable rollback [y/N]: N
2023-11-14 21:09:27,583 | No Parameters detected in the template
2023-11-14 21:09:27,621 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is HelloWorldFunction
2023-11-14 21:09:27,623 | There is no customer defined id or cdk path defined for resource ApplicationResourceGroup, so we will use the resource logical id as the resource id
2023-11-14 21:09:27,626 | There is no customer defined id or cdk path defined for resource ApplicationInsightsMonitoring, so we will use the resource logical id as the resource id
2023-11-14 21:09:27,630 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2023-11-14 21:09:27,637 | 4 resources found in the stack
2023-11-14 21:09:27,640 | Found Serverless function with name='HelloWorldFunction' and CodeUri='HelloWorldFunction'
2023-11-14 21:09:27,643 | --base-dir is not presented, adjusting uri HelloWorldFunction relative to /home/cloudshell-user/environment/chimeMeeting/.aws-sam/build/template.yaml
2023-11-14 21:09:27,648 | Detected Inline Swagger definition
2023-11-14 21:09:27,653 | Auth checks done on swagger are not exhaustive!
HelloWorldFunction has no authentication. Is this okay? [y/N]: Y
2023-11-14 21:09:31,912 | 4 resources found in the stack
2023-11-14 21:09:31,915 | Found Serverless function with name='HelloWorldFunction' and CodeUri='HelloWorldFunction'
2023-11-14 21:09:31,918 | --base-dir is not presented, adjusting uri HelloWorldFunction relative to /home/cloudshell-user/environment/chimeMeeting/.aws-sam/build/template.yaml
2023-11-14 21:09:31,921 | No function or layer definition found with code sign config, skipping
Save arguments to configuration file [Y/n]: Y
SAM configuration file [samconfig.toml]: samconfig.toml
SAM configuration environment [default]:

    Looking for resources needed for deployment:

/usr/local/lib/python3.7/site-packages/boto3/compat.py:82: PythonDeprecationWarning: Boto3 will no longer support Python 3.7 starting December 13, 2023. To continue receiving service updates, bug fixes, and security updates please upgrade to Python 3.8 or later. More information can be found here: https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/
warnings.warn(warning, PythonDeprecationWarning)

    Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-za1nvakev7gj
    A different default S3 bucket can be set in samconfig.toml and auto resolution of buckets turned off by setting resolve_s3=False

2023-11-14 21:09:44,574 | 4 resources found in the stack
2023-11-14 21:09:44,576 | Found Serverless function with name='HelloWorldFunction' and CodeUri='HelloWorldFunction'
2023-11-14 21:09:44,578 | --base-dir is not presented, adjusting uri HelloWorldFunction relative to /home/cloudshell-user/environment/chimeMeeting/.aws-sam/build/template.yaml
2023-11-14 21:09:44,626 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-11-14 21:09:44,653 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-11-14 21:09:44,655 | Unable to find Click Context for getting session_id.
2023-11-14 21:09:44,658 | Sending Telemetry: {'metrics': [{'events': {'requestId': '4735070a-ca4f-40b1-98a0-691426c1a62a', 'installationId': '6a3134fe-b839-4114-8f23-fa5ab78eefda', 'sessionId': 'e45404e6-326e-4b41-a3bd-b33751a51c12', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.16',
'samcliVersion': '1.97.0', 'userAgent': 'AWS-CloudShell/2023.09.15', 'commandName': 'sam deploy', 'metricSpecificAttributes': {'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': 'ac3c13786b894a9ea0a76bc34d68c812', 'time_stamp': '2023-11-14 21:08:47.492',
'exception_name': None}, {'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': 'eb0ac9f118e24913a8987ab51d569d53', 'time_stamp': '2023-11-14 21:08:48.242', 'exception_name': None}]}}}]}
2023-11-14 21:09:44,655 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '848943be-0b4c-48f9-a912-d5f6292b72e6', 'installationId': '6a3134fe-b839-4114-8f23-fa5ab78eefda', 'sessionId': 'e45404e6-326e-4b41-a3bd-b33751a51c12', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.16',
'samcliVersion': '1.97.0', 'userAgent': 'AWS-CloudShell/2023.09.15', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam deploy', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName':
'a7df3489b0f95d0415f1e4fc7314a228cca6d3ba8422a791f646db935ada038d', 'initialCommit': None}, 'duration': 57043, 'exitReason': 'ValueError', 'exitCode': 255}}]}
2023-11-14 21:09:44,975 | Telemetry response: 200
2023-11-14 21:09:44,979 | Telemetry response: 200

Error: Invalid endpoint: https://sts..amazonaws.com
Traceback:
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/samcli/lib/cli_validation/image_repository_validation.py", line 110, in wrapped
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/samcli/lib/telemetry/metric.py", line 184, in wrapped
raise exception # pylint: disable=raising-bad-type
File "/usr/local/lib/python3.7/site-packages/samcli/lib/telemetry/metric.py", line 149, in wrapped
return_value = func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/samcli/lib/utils/version_checker.py", line 42, in wrapped
actual_result = func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/samcli/cli/main.py", line 95, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/samcli/commands/_utils/cdk_support_decorators.py", line 39, in wrapped
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/samcli/commands/_utils/command_exception_handler.py", line 88, in wrapper_command_exception_handler
raise ex
File "/usr/local/lib/python3.7/site-packages/samcli/commands/_utils/command_exception_handler.py", line 68, in wrapper_command_exception_handler
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/samcli/commands/deploy/command.py", line 227, in cli
on_failure,
File "/usr/local/lib/python3.7/site-packages/samcli/commands/deploy/command.py", line 292, in do_cli
guided_context.run()
File "/usr/local/lib/python3.7/site-packages/samcli/commands/deploy/guided_context.py", line 576, in run
self.guided_prompts(_parameter_override_keys)
File "/usr/local/lib/python3.7/site-packages/samcli/commands/deploy/guided_context.py", line 197, in guided_prompts
stack_name, stacks, self.image_repositories, region, managed_s3_bucket, self.s3_prefix
File "/usr/local/lib/python3.7/site-packages/samcli/commands/deploy/guided_context.py", line 363, in prompt_image_repository
manager = CompanionStackManager(stack_name, region, s3_bucket, s3_prefix)
File "/usr/local/lib/python3.7/site-packages/samcli/lib/bootstrap/companion_stack/companion_stack_manager.py", line 55, in init
self._account_id = boto3.client("sts").get_caller_identity().get("Account")
File "/usr/local/lib/python3.7/site-packages/boto3/init.py", line 92, in client
return _get_default_session().client(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/boto3/session.py", line 309, in client
config=config,
File "/usr/local/lib/python3.7/site-packages/botocore/session.py", line 1007, in create_client
auth_token=auth_token,
File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 171, in create_client
partition_data,
File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 502, in _get_client_args
partition_data,
File "/usr/local/lib/python3.7/site-packages/botocore/args.py", line 148, in get_client_args
proxies_config=new_config.proxies_config,
File "/usr/local/lib/python3.7/site-packages/botocore/endpoint.py", line 402, in create_endpoint
raise ValueError("Invalid endpoint: %s" % endpoint_url)

An unexpected error was encountered while executing "sam deploy".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20deploy%20-%20ValueError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20deploy%20-%20ValueError

Expected result:

Uploading to chimeSdkWorkshop/4d08963eaxxx000xxx54a224d541 549916 / 549916 (100.00%)

    Deploying with following values
    ===============================
    Stack name                   : chimeSdkWorkshop
    Region                       : us-east-1
    Confirm changeset            : False
    Disable rollback             : False
    Deployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-1kwje8x0vlkn6
    Capabilities                 : ["CAPABILITY_IAM"]
    Parameter overrides          : {}
    Signing Profiles             : {}

Initiating deployment

Uploading to chimeSdkWorkshop/78602e1003eaxxx000xxx56ba10d64ae44e.template 1199 / 1199 (100.00%)

Waiting for changeset to be created..
CloudFormation stack changeset

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: (CloudShell)
  2. sam --version: SAM CLI, version 1.97.0
  3. AWS region: us-east-1
# Paste the output of `sam --info` here
 sam --info
{
  "version": "1.97.0",
  "system": {
    "python": "3.7.16",
    "os": "Linux-6.1.59-84.139.amzn2023.x86_64-x86_64-with-glibc2.2.5"
  },
  "additional_dependencies": {
    "docker_engine": "Not available",
    "aws_cdk": "2.95.1 (build ae455d8)",
    "terraform": "Not available"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}

Add --debug flag to command you are running

@JeepNguy JeepNguy added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Nov 14, 2023
@hnnasit
Copy link
Contributor

hnnasit commented Nov 16, 2023

Hi @JeepNguy, thanks for reporting the issue. Could you provide the template file and the app for us to reproduce and investigate this issue?

@hnnasit hnnasit added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. area/deploy sam deploy command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Nov 16, 2023
@hnnasit hnnasit added the blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days label Mar 6, 2024
@MapleSage
Copy link

Any updates on this issue? Faced this on second attempt, first time it worked

@mildaniel
Copy link
Contributor

@MapleSage, if you're still facing this problem, please open a new issue with the template you are using. Sometimes the version of SAM CLI used in cloudshell lags behind the latest version which can cause issues with deprecated runtimes. It's difficult for us to tell without seeing any of the configuration.

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy sam deploy command blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

4 participants