aws-amplify / aws-amplify/amplify-cli

Better error messaging for amplify hosting publish

Open
#11,382 2 comments 0 reactions 1 assignee Claimed by @josefaidt View on GitHub
feature-request hosting p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Before opening, please confirm:

- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/dev/CONTRIBUTING.md#bug-reports).
- [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.

### How did you install the Amplify CLI?

_No response_

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

_No response_

### Amplify CLI Version

10.4.0

### What operating system are you using?

Windows

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

No

### Amplify Categories

hosting

### Amplify Commands

publish

### Describe the bug

When publishing a application using hosting, amplify CLI throws the following error

```
× Error has occurred during file upload.
An error occurred during the publish operation: Access Denied
```
this is due to the wrong `DistributionDir` in the project-config.json.

### Expected behavior

Warning should throw something as follows

```
You may get an "AccessDenied" error if your app's distribution directory is not set properly. To fix this, change the distribution directory via amplify configure project and then re-run amplify publish.
The `Block public access to buckets and objects granted through new access control lists (ACLs)` needs to be allowed
```

### Reproduction steps

1. amplify init
give wrong distribution directory
3. amplify add hosting
√ Select the plugin module to execute · Amazon CloudFront and S3
? Select the environment setup: DEV (S3 only with HTTP)
? hosting bucket name grapgqltest-20221111165143-hostingbucket
? index doc for the website index.html
? error doc for the website index.html
4. amplify publish

### GraphQL schema(s)

```graphql
# Put schemas below this line

```

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.