Amplify-cli: Receiving Error: "The specified bucket does not exist" when adding amplify resources

Created on 27 Jun 2019  Â·  8Comments  Â·  Source: aws-amplify/amplify-cli

Describe the bug
I added DynamoDB storage, using amplify add storage, to an existing, functional Amplify app with existing, functional Auth and S3 Storage, and when I push, I get the following error:

An error occurred when pushing the resources to the cloud 
The specified bucket does not exist

NOTE: This error happens when I try to add any resource (e.g. a function), not just DynamoDB.

To Reproduce

  1. run amplify add storage
  2. select NoSQL Database
  3. enter friendly name (use default)
  4. enter table name (use default)
  5. add fields (e.g. fileName, string)
  6. choose partition key
  7. no sort key
  8. no global secondary indexes
  9. receive message : "Successfully added resource dynamoxxxxxx locally"
  10. run amplify push
  11. receive amplify status like below
| Category | Resource name     | Operation | Provider plugin   | 
| -------- | ----------------- | --------- | ----------------- |
| Storage  | dynamo1a4f9186    | Create    | awscloudformation |
| Auth     | slugorama268422e5 | No Change | awscloudformation |
| Storage  | slugoramaStorage  | No Change | awscloudformation |
? Are you sure you want to continue? (Y/n)  
  1. continue with Enter (Yes)
  2. receive error mentioned above

Expected behavior
The DynamoDB should be provisioned.

Desktop (please complete the following information):

  • OS: Windows 10, using amplify CLI in WSL

Additional context
I've tried to figure out if the amplify CLI has a debug feature to see more details about the error I'm receiving, but I've come up short in that department.

If I remove the newly added NoSQL storage and run amplify push, I receive the following message, which is expected:

```console
No changes detected
````

I did, at one time, have CLI added hosting on this app, but I couldn't add a custom domain, so I removed that hosting (manually removing the s3 hosting bucket), and published the app via a repo, but I'm still using the CLI provisioned auth and S3 backend resources (not sure if that's the best way to do things).

I've looked through the files in amplify/.config to see if there are any offending entries that could be causing this, but couldn't seem to find any that looked like a trouble-maker.

Any help on this would be most appreciated.

Thanks.

pending-response question storage

Most helpful comment

So it seems that I was right and perhaps you deleted the wrong bucket. To double check, please check that the bucket name you have in team-provider-info.json for DeploymentBucketName exists, I assume not, but please confirm.

All 8 comments

@kimfucious I was not able to reproduce this with the latest version of the CLI, could you please tell what version are you using?

Also something to try is amplify storage update to trigger a change in resources and try amplify push after that, to make sure that push is working in general for your project.

If you could share the exact content what you see in the console could help to resolve your issue.

Hi @attilah

Thanks for the quick reply.

Amplify version is 1.7.5 installed via NPM, via $ npm install -g @aws-amplify/cli just the other day.

Here's my output on your recommendations after removing any new resources I was trying to add.

I now get the same error with the existing resources that were working prior. Alas, I don't know how to run a debug, to get more info on this error.

kim@winnie:.../Sites/workspace/slug-o-rama$ amplify storage update 
? Please select from one of the below mentioned services Content (Images, audio, video, etc.) 
? Who should have access: Auth users only
? What kind of access do you want for Authenticated users? (Press <space> to select, <a> to toggle all, <i> to invert selection)create/update, read, delete 
Successfully updated resource 

and then

kim@winnie:.../Sites/workspace/slug-o-rama$ amplify push 

Current Environment: beta 

| Category | Resource name     | Operation | Provider plugin   | 
| -------- | ----------------- | --------- | ----------------- |
| Storage  | slugoramaStorage  | Update    | awscloudformation |
| Auth     | slugorama268422e5 | No Change | awscloudformation |
? Are you sure you want to continue? Yes 
✖ An error occurred when pushing the resources to the cloud 

The specified bucket does not exist

I'm tempted to kill the whole thing and start over, but I'd rather figure out what's going wrong so as to be able to fix such things in production if/when they go bad.

So it seems that I was right and perhaps you deleted the wrong bucket. To double check, please check that the bucket name you have in team-provider-info.json for DeploymentBucketName exists, I assume not, but please confirm.

You are spot on!

The entry in the team-provider-info.json file is:

"DeploymentBucketName": "slug-o-rama-beta-20190625175625-deployment",

and that bucket, indeed, does not exist when viewing my S3 buckets in the AWS console.

Not sure how I got into this fix, and oddly the app is working, but how do I get out of it?

@kimfucious that bucket is used only for deployment operations and is not used for running your app, that's the reason it works.

Let me get back to you on possible ways to recover from this situation.

Cool, thanks.

I did just try to manually create the bucket slug-o-rama-beta-20190625175625-deployment in the AWS S3 console and run amplify push, and things seemed to have happened!

I'll report back with future findings.

BTW: how in the world did you deduce that I'd deleted a bucket and that it would be in that particular file?

If that works fine, I already checked the default template we're using to create the bucket and we've no special permissions set on it, just the default secure-by-default ones as you can see here: https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-provider-awscloudformation/lib/rootStackTemplate.json#L20

I just was not sure if we need to do any special operations before a sync to that bucket would happen upon push, but I'm glad that you tried out and it works.

The CLI using that file to store cloud resource identifiers what we reuse across deployment operations and you mentioned that you had hosting and deleted a bucket, I assumed that you deleted the "wrong one" ;-)

I'm closing this issue now, but if you have further questions or comments feel free to reopen it at a later time.

Thanks, @attilah

I think I'm sorted now, after the manual re-creation of that bucket.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kangks picture kangks  Â·  3Comments

nicksmithr picture nicksmithr  Â·  3Comments

zjullion picture zjullion  Â·  3Comments

jexh picture jexh  Â·  3Comments

onlybakam picture onlybakam  Â·  3Comments