Closed gagan1469 closed 4 months ago
Hello,
How did you set the AWS_REGION environment variable exactly? The error means that the region was not set.
Hi Mike, The region was provided in the following different ways:
Set in gdk-config.json
"publish": {
"region": "us-east-1",
"bucket": "ggv2-component-artifacts"
}
When that did not work, I also used the --region argument when running component publish
gdk component publish --region us-east-1 --debug
In both cases, I got the same error.
There is no "--region" option for GDK.
Set the AWS_DEFAULT_REGION environment variable.set AWS_DEFAULT_REGION=us-east-1
if you are using cmd.
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html#envvars-set
Regarding the --region option, I just followed the gdk component publish --help output:
gdk component publish --help
usage: gdk component publish [-h] [-d] [-v] [-b BUCKET] [-r REGION] [-o OPTIONS] {} ...
Create a new version of a GreengrassV2 component from its built artifacts and recipes.
positional arguments:
{}
options:
-h, --help show this help message and exit
-d, --debug Increase command output to debug level
-v, --version show program's version number and exit
-b BUCKET, --bucket BUCKET
Name of the s3 bucket to use for uploading component artifacts. This argument
overrides the bucket name provided in the gdk configuration.
-r REGION, --region REGION
Name of the AWS region to use during component creation. This argument overrides
the region name provided in the gdk configuration.
-o OPTIONS, --options OPTIONS
Extra configuration options used during component version creation. This argument
needs to be a valid json string or file path to a JSON file containing the publish
options. This argument overrides the options provided in the gdk configuration.
That said, using AWS_DEFAULT_REGION=us-east-1 environment variable in Windows did the trick. Thanks for the support.
Describe the bug component publish is throwing InvalidRegionError in Windows 10
To Reproduce
Expected behavior Component should have published to S3 bucket in account. The same code/setup works in Amazon Linux 2023 OS.
Actual behavior Throws error \botocore\utils.py", line 1320, in validate_region_name raise InvalidRegionError(region_name=region_name) botocore.exceptions.InvalidRegionError: Provided region_name '' doesn't match a supported format.
Environment
Additional context Workaround by hard-coding the region in Line 149 of aws-greengrass-gdk-cli\gdk\commands\component\config\ComponentPublishConfiguration.py Original: _sts_client = boto3.client("sts") Changed: _sts_client = boto3.client("sts", 'us-east-1')