Skip to content

Unable to upload to S3 bucket if bucket name is a variable #10008

@SeanStanway-Octopus

Description

@SeanStanway-Octopus

Severity

2 customers reported, recreated in latest cloud

Version

2026.2.9314

Latest Version

None

What happened?

When trying to use the "Upload a package to an AWS S3 bucket" step, if you specify the bucket name as a variable, an AWS exception of "The specified bucket is not valid" will be thrown.

Reproduction

  1. Add a "Upload a package to an AWS S3 bucket"
  2. Put your S3 bucket name as a project variable
  3. Add any package
  4. Run the release

Error and Stacktrace

12:29:49   Error    |       Amazon.S3.AmazonS3Exception: The specified bucket is not valid.
12:29:49   Error    |       ---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
12:29:49   Error    |       at Amazon.Runtime.HttpWebRequestMessage.ProcessHttpResponseMessage(HttpResponseMessage responseMessage)
12:29:49   Error    |       at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
12:29:49   Error    |       at Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.RedirectHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       --- End of inner exception stack trace ---
12:29:49   Error    |       at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream)
12:29:49   Error    |       at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext executionContext, HttpErrorResponseException exception)
12:29:49   Error    |       at Amazon.Runtime.Internal.ExceptionHandler`1.HandleAsync(IExecutionContext executionContext, Exception exception)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext executionContext, Exception exception)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.Signer.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Internal.S3Express.S3ExpressPreSigner.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.BaseAuthResolverHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Util.AmazonS3Util.DoesS3BucketExistV2Async(IAmazonS3 s3Client, String bucketName)
12:29:49   Error    |       at Calamari.Aws.Deployment.Conventions.CreateS3BucketConvention.EnsureBucketExists(Func`1 clientFactory, String bucketName) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Aws\Deployment\Conventions\CreateS3BucketConvention.cs:line 50
12:29:49   Error    |       at Calamari.Aws.Deployment.Conventions.CreateS3BucketConvention.Install(RunningDeployment deployment) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Aws\Deployment\Conventions\CreateS3BucketConvention.cs:line 31
12:29:49   Error    |       at Calamari.Deployment.ConventionProcessor.RunInstallConventions(IEnumerable`1 installConventions) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 80
12:29:49   Error    |       at Calamari.Deployment.ConventionProcessor.RunConventions(Boolean logExceptions) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 31
12:29:49   Error    |       The specified bucket is not valid.
12:29:49   Error    |       Amazon.S3.AmazonS3Exception
12:29:49   Error    |       at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream)
12:29:49   Error    |       at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext executionContext, HttpErrorResponseException exception)
12:29:49   Error    |       at Amazon.Runtime.Internal.ExceptionHandler`1.HandleAsync(IExecutionContext executionContext, Exception exception)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext executionContext, Exception exception)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.Signer.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Internal.S3Express.S3ExpressPreSigner.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.BaseAuthResolverHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Util.AmazonS3Util.DoesS3BucketExistV2Async(IAmazonS3 s3Client, String bucketName)
12:29:49   Error    |       at Calamari.Aws.Deployment.Conventions.CreateS3BucketConvention.EnsureBucketExists(Func`1 clientFactory, String bucketName) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Aws\Deployment\Conventions\CreateS3BucketConvention.cs:line 50
12:29:49   Error    |       at Calamari.Aws.Deployment.Conventions.CreateS3BucketConvention.Install(RunningDeployment deployment) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Aws\Deployment\Conventions\CreateS3BucketConvention.cs:line 31
12:29:49   Error    |       at Calamari.Deployment.ConventionProcessor.RunInstallConventions(IEnumerable`1 installConventions) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 80
12:29:49   Error    |       at Calamari.Deployment.ConventionProcessor.RunConventions(Boolean logExceptions) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 31
12:29:49   Error    |       at Calamari.Aws.Commands.UploadAwsS3Command.Execute(String[] commandLineArguments) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Aws\Commands\UploadAwsS3Command.cs:line 96
12:29:49   Error    |       at Calamari.Program.ResolveAndExecuteCommand(IContainer container, CommonOptions options) in C:\BuildAgent\work\62728692c7c35200\source\Calamari\Program.cs:line 66
12:29:49   Error    |       at Calamari.Common.CalamariFlavourProgram.Run(String[] args) in C:\BuildAgent\work\62728692c7c35200\source\Calamari.Common\CalamariFlavourProgram.cs:line 79
12:29:49   Error    |       --Inner Exception--
12:29:49   Error    |       Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
12:29:49   Error    |       Amazon.Runtime.Internal.HttpErrorResponseException
12:29:49   Error    |       at Amazon.Runtime.HttpWebRequestMessage.ProcessHttpResponseMessage(HttpResponseMessage responseMessage)
12:29:49   Error    |       at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
12:29:49   Error    |       at Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.RedirectHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeAsync[T](IExecutionContext executionContext)
12:29:49   Error    |       at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)

More Information

No response

Workaround

Hardcoding the bucket name will allow the step to complete successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugThis issue represents a verified problem we are committed to solving

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions