apigee / apigee/apigeetool-node
Misleading exception when there is no base apiproxy directory
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 91
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
When using the -d option from the deployproxy command, the error makes no hint that the cli was looking for a child directory called apiproxy.
Using a directory structure of:
getstarted
└── proxy
├── getstarted.xml
├── policies
├── proxies
│ └── default.xml
└── targets
└── default.xml
Running:
apigeetool deployproxy -d ./getstarted
Outputs:
Error: Proxy base directory ./getstarted does not exist
at getDeploymentInfo (/Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:196:10)
at /Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:113:7
at /Users/michaelcarey/workspace/apigee-demo/node_modules/async/lib/async.js:718:13
at Immediate.iterate [as _onImmediate] (/Users/michaelcarey/workspace/apigee-demo/node_modules/async/lib/async.js:262:13)
at processImmediate (internal/timers.js:439:21)
Error: Proxy base directory ./getstarted does not exist
at getDeploymentInfo (/Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:196:10)
at /Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:113:7
at /Users/michaelcarey/workspace/apigee-demo/node_modules/async/lib/async.js:718:13
at Immediate.iterate [as _onImmediate] (/Users/michaelcarey/workspace/apigee-demo/node_modules/async/lib/async.js:262:13)
at processImmediate (internal/timers.js:439:21)
I interpret this as the directory ./getstarted does not exist. Similarly adding the proxy directory after also makes it look the directory ./getstarted/proxy does not exist. Reading through the code reveals a a non-configurable directory name. The error comes from here which only passes the opt.directory into the error.
Suggestion/Request
- Can we please make that error a little more obvious or at least include the
apiproxydirectory so you know that the code is appending it without reading the code? - Can we make this value configurable? I think it will be fine without, but it might be nice to allow users to choose what they name their root directory. If anything, can we please get the help page updated. The description for
-donly saysDirectory.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/commands/deployproxy.js, especially the directory name near line 21 and the error handling at lines 194-197. Reproduce the -d ./getstarted case, then clarify the missing apiproxy directory in the error and review the -d help description; done means users can identify the expected directory from the CLI output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100