aws-toolkit-azure-devops
aws-toolkit-azure-devops copied to clipboard
IllegalLocationConstraintException when create S3 bucket
I am using task S3Upload@1
in my yaml running in Azure DevOps.
When I set createBucket
to true
as below:
- task: S3Upload@1
inputs:
awsCredentials: testserviceconnection
regionName: us-east-1
bucketName: somethingtest
sourceFolder: cfntest
globExpressions: '**'
targetFolder: clientlambda
createBucket: true
I got an error as below:
message: 'The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.',
code: 'IllegalLocationConstraintException',
region: null,
I think except bucketName
, LocationConstraint
should be set as well? Regarding the issue https://github.com/aws/aws-sdk-js/issues/475
Somehow the region is passed to the function, but it is not used anywhere.
https://github.com/aws/aws-toolkit-azure-devops/blob/6590be0558e2bd45cb4fb873be0f5616a7cac769/src/tasks/S3Upload/TaskOperations.ts#L63
Hi @linfengslalom ; apologies for the delay in responding. The region should be used when constructing the client (you'll have to npm run build
the package to see that output).
Out of curiosity, could you try wrapping the region name in quotes? That might resolve the issue (specifically, the YAML generated by the UI wraps that value in quotes).
Hi, thanks for your response. This is no longer the issue for me. When the default region and the bucket region are the same, there is no problem creating the bucket.
I think except bucketName, LocationConstraint should be set as well?
The SDK supposedly sets this automatically but maybe it uses the credentials region rather than the client config. We probably have to force it within the Toolkit as it's unlikely for this to be fixed within the legacy SDK.