-
Notifications
You must be signed in to change notification settings - Fork 820
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
Can't create bucket Bucket name should be between 3 and 63 characters long #2928
Comments
Additional info If I don't use the defaults It gives me a different error amplify storage add
|
To get around the issue I temporarily edited the cloud formation template taking the stack name out of the bucket name and it worked. Attached cloud formation templates (original and edited) as txt files because github does not let me to upload json files "S3Bucket": {
"Type": "AWS::S3::Bucket",
"DeletionPolicy" : "Retain",
"Properties": {
"BucketName": {
"Fn::If": [
"ShouldNotCreateEnvResources",
{
"Ref": "bucketName"
},
{
"Fn::Join": [
"",
[
{
"Ref": "bucketName"
},
{
"Fn::Select": [
3,
{
"Fn::Split": [
"-",
{
"Ref": "AWS::StackName"
}
]
}
]
},
"-",
{
"Ref": "env"
}
]
]
}
]
}, |
@emanuelherrmann Thanks for the updates we will be looking and get back to you |
Hi @emanuelherrmann I was unable to reproduce this using the same bucket name and a 10 character env name. What was BucketName in your amplify-meta file? |
Hi @nikhname I think it has to do with the fact that is using the 4th element of the stack name split for the bucket name. I think the issue happened because I created the project and the production environment with an older version of the cli. Then i added a new environment because I wanted to do a lot of changes I was using version 4.5.0 of the cli at that time that's when I created the bucket and it worked in the new environment. But when I merged the changes into the production environment I got the error "Bucket name should not contain uppercase characters ". This is exacted from my team-provider-info.json (See the stack names)
'eherrrmann' was the new env I created with 4.5.0 so the stack name has a 4th element if you split by '-', but in case of production it doesn't so that returns undefined and apparently the cli uses random uppercase characters in that case which causes the bucket name to have uppercase characters and fail while creating the bucket. Am I doing something wrong? How do I Keep my production up to date when amplify updates the cli? |
@emanuelherrmann could you describe the way you merged your new environment into the prod environment? |
Hi @nikhname below is a summary of the steps I followed
After that, I tried to create the bucket directly in the production env (reverting the merge first ), but it gave me the error as well. The only workaround I found was to remove the following from the bucket name in the cloud formation template. { |
I had this problem too, on a greenfield project. Once I started using a custom bucket name instead of the suggested default (the one w/ the long UUID), everything worked fine. |
Hi @emanuelherrmann I have been able to repro this issue but we have decided not to move forward with a general fix for it. You are correct that the issue arises because the old version of the CLI generated stack names with a different format than newer versions. To work around the issue, we recommend that you change the selection index in the S3 CloudFormation template to be the number component of the stack name listed in Sorry we aren't able to work on a fix at this time. However, if more people run into this migration issue we may revisit that decision in the future. |
Please provide a general fix for this. |
I'm running into a related issue regarding capitalized letters in the Resource Name (AppStorage) with the bucket name set to "app-storage". My new environment was able to create an s3 bucket no problem, even with the resource name being capitalized, but my old environment, my production environment wasn't able to create the bucket because it said there were capital letters in the bucket name. The cloudformation templates are the same between the two and I'm not sure how to fix it. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
Can't create a bucket
Amplify CLI Version
You can use
amplify -v
to check the amplify cli version on your systemamplify -v
4.5.0
The project was created with an earlier version of the CLI (not sure which one)
To Reproduce
Steps to reproduce the behavior or terminal output if applicable
amplify add storage
? Please select from one of the below mentioned services: Content (Images, audio, video, etc.)
? Please provide a friendly name for your resource that will be used to label this category in the project: s326a12cbf
? Please provide bucket name: testadminrolee5d2d1154a9c49cd8670eae587a9ba1c
? Who should have access: Auth users only
? What kind of access do you want for Authenticated users? create/update
? Do you want to add a Lambda Trigger for your S3 Bucket? No
Successfully added resource s326a12cbf locally
amplify push --yes
Expected behavior
It should create the bucket, but it giving me this message
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: