aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 819 forks source link

S3 resource fails in amplify push for too-long bucket name #13364

Open stuartlangridge opened 11 months ago

stuartlangridge commented 11 months ago

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v18.17.1

Amplify CLI Version

10.7.3

What operating system are you using?

Ubuntu

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Describe the bug

I have created a new environment (with amplify env add) named stuartprod, and am now trying to amplify push to deploy the environment. I get the following error:

Deploying storage s3linkfiles [ ---------------------------------------- ] 0/9
    S3Bucket                       AWS::S3::Bucket                CREATE_FAILED                  Mon Oct 23 2023 14:57:56…     

🛑 The following resources failed to deploy:
Resource Name: S3Bucket (AWS::S3::Bucket)
Event Type: create
Reason: Bucket name should be between 3 and 63 characters long

🛑 Resource is not in the state stackUpdateComplete
Name: S3Bucket (AWS::S3::Bucket), Event Type: create, Reason: Bucket name should be between 3 and 63 characters long

I don't know what the bucket name that it's trying to create actually is, and I don't know how to find out. The name of the whole project is projnewcomponents. I note that in the existing environment (called staging), the name of the bucket is projnewcomponents5ddb(28 hex chars)3503-staging, which is 61 characters long. So perhaps it's trying to create projnewcomponents5ddb(28 hex chars)3503-stuartprod which would be 64 characters long and therefore too long? This is OK if so, but there really ought to be a warning about this somewhere!

Expected behavior

Either this shouldn't fail, or, if the constructed bucket name is too long, it should tell me what the failing bucket name is so I can try to resolve it.

Reproduction steps

I don't know what's causing this (although see speculation above) so it's hard to know how to reproduce it.

Project Identifier

No response

Log output

``` # Put your logs below this line ```

Additional information

No response

Before submitting, please confirm:

ykethan commented 11 months ago

Hey @stuartlangridge, thank you for reaching out. I was able to reproduce the issue using the following steps

  1. amplify init -> named projnewcomponents
  2. amplify add storage observed the bucket name was greater then 63 characters as follows image amplify push fails with Reason: Bucket name should be between 3 and 63 characters long.

marking as bug.

Dhruval7878 commented 10 months ago

can someone assign me this issue please ?

Dhruval7878 commented 10 months ago

can someone assign me this issue please ?

heii @ykethan