aws-amplify / aws-amplify/amplify-cli
'jsonString' argument missing or empty - Any/all amplify cli commands
- 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?
v14.13.0
### Amplify CLI Version
Cant run this command
### What operating system are you using?
mac
### Amplify Categories
auth, storage, analytics
### Amplify Commands
env, init, status
### Describe the bug
I all of a sudden can't run any amplify commands without this error output, not even amplify version. Happened randomly after coming back to a codebase with no changes after using amplify cli on the project it without issues the day before.
### Expected behavior
amplify cli allows me to run commands without error.
### Reproduction steps
npm install -g @aws-amplify/cli
amplify status // amplify version // amplify checkout env // amplify
### GraphQL schema(s)
_No response_
### Log output
```
EL-MacBook-Pro:dinnerbell elarkin$ amplify status
'jsonString' argument missing or empty
Error: 'jsonString' argument missing or empty
at Function.JSONUtilities.parse (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/jsonUtilities.js:79:15)
at Function.JSONUtilities.readJson (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/jsonUtilities.js:47:32)
at StateManager.getData (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/state-manager/stateManager.js:282:56)
at StateManager.getLocalEnvInfo (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/state-manager/stateManager.js:91:25)
at Function.HooksMeta.getInstance (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/lib/hooks/hooksMeta.js:99:76)
at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/lib/index.js:138:56)
```
### Additional information
I made no code changes, just wanted to change amplify environment and now I am getting this error with every amplify command. I tried deleting node modules and reintalling them and reinstalling aws-amplify cli.
Error: 'jsonString' argument missing or empty
Contributor guide
Research direction
Reproduce the failure with `amplify status` or another command, then follow the reported call chain from `amplify-cli-core/lib/jsonUtilities.js` through `state-manager/stateManager.js` and `hooks/hooksMeta.js` into `lib/index.js`. Determine why the JSON input is empty and verify that the affected Amplify commands, including `amplify version`, run without this error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100