aws-amplify / aws-amplify/amplify-cli
S3 resource fails in amplify push for too-long bucket name
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### 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:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Contributor guide
Research direction
Begin at the amplify push storage deployment path and inspect how S3Bucket names are constructed for environments created with amplify env add. Confirm the generated name and compare it with S3's 3–63-character constraint; done means the failure reports the actual name or deployment no longer rejects valid configuration. No file or test is named in the issue, so locating the relevant code and adding coverage will require repository research.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100