aws-amplify / aws-amplify/amplify-cli
override auth fails in empty projects: Cannot convert undefined or null to object
- 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/master/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
### How did you install the Amplify CLI?
npm
### If applicable, what version of Node.js are you using?
14
### Amplify CLI Version
7.x
### What operating system are you using?
macos
### Amplify Categories
auth
### Amplify Commands
Not applicable
### Describe the bug
`override auth` fails when project has no resources:
```
Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
at Function.keys ()
at Object.run (/Users/attila/workspaces/amplify-cli/packages/amplify-category-auth/lib/commands/auth/override.js:17:12)
at Object.executeAmplifyCommand (/Users/attila/workspaces/amplify-cli/packages/amplify-category-auth/lib/index.js:336:25)
at /Users/attila/workspaces/amplify-cli/packages/amplify-cli/lib/execution-manager.js:203:51
at executePluginModuleCommand (/Users/attila/workspaces/amplify-cli/packages/amplify-cli/lib/execution-manager.js:187:11)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.executeCommand (/Users/attila/workspaces/amplify-cli/packages/amplify-cli/lib/execution-manager.js:35:9)
at async Object.run (/Users/attila/workspaces/amplify-cli/packages/amplify-cli/lib/index.js:162:9)
```
### Expected behavior
Provide proper error message
### Reproduction steps
1. amplify init
2. amplify add override
### GraphQL schema(s)
```graphql
# Put schemas below this line
```
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.