Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading exception when there is no base apiproxy directory #188

Open
mike-carey opened this issue May 1, 2020 · 3 comments
Open

Misleading exception when there is no base apiproxy directory #188

mike-carey opened this issue May 1, 2020 · 3 comments

Comments

@mike-carey
Copy link

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

  1. Can we please make that error a little more obvious or at least include the apiproxy directory so you know that the code is appending it without reading the code?
  2. 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 -d only says Directory.
@whitlockjc
Copy link
Member

So you're saying that when using -d, even when the directory used exists, if {dir}/apiproxy does not exist it gives the error above?

@mike-carey
Copy link
Author

Yes, that is correct @whitlockjc. Do you believe that the error message should be in that format instead?

@mike-carey
Copy link
Author

It seems that deploysharedflow does the same thing: https://github.com/apigee/apigeetool-node/blob/master/lib/commands/deploysharedflow.js#L126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants