apigeetool-node
apigeetool-node copied to clipboard
deployproxy allows a `null` API name
Description
When sending a blank api name to deployproxy, the CLI seems to use null in the URL causing a problem when attempting to grab the current revision. As a result, it attempts to create the revision as NaN and the server responds with 500 Internal Server Error
Steps to Reproduce
apigeetool deployproxy \
-n '' \
-o "$APIGEE_ORG" \
-e "$APIGEE_ENV" \
-L https://api.enterprise.apigee.com \
-u "$APIGEE_USERNAME" \
-p "$APIGEE_PASSWORD" \
-d "$directory" \
-t "$token" \
-V
Expected Results
You have not provided the name of the api
I would expect some sort of 4XX Client HTTP Status Code from the server.
Actual Results
Going to create revision NaN of API
Using getstarted/apiproxy/getstarted.xml as the root file
Creating revision NaN of API
Proxy creation error: {
"code" : "repository.filesystem.FailedToLoadFile",
"message" : "Failed to load file : /organizations/$ORG/apiproxies/null/revisions/0f99f333-43e4-45da-bffd-1a8fae63c5d8/0f99f333-43e4-45da-bffd-1a8fae63c5d8.xml",
"contexts" : [ ]
}
Error: Proxy creation failed. Status code 500
at proxyCreationDone (/Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:299:10)
at Request._callback (/Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:286:5)
at Request.self.callback (/Users/michaelcarey/workspace/apigee-demo/node_modules/request/request.js:185:22)
at Request.emit (events.js:203:13)
at Request.<anonymous> (/Users/michaelcarey/workspace/apigee-demo/node_modules/request/request.js:1154:10)
at Request.emit (events.js:203:13)
at IncomingMessage.<anonymous> (/Users/michaelcarey/workspace/apigee-demo/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:291:20)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
Error: Proxy creation failed. Status code 500
at proxyCreationDone (/Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:299:10)
at Request._callback (/Users/michaelcarey/workspace/apigee-demo/node_modules/apigeetool/lib/commands/deployproxy.js:286:5)
at Request.self.callback (/Users/michaelcarey/workspace/apigee-demo/node_modules/request/request.js:185:22)
at Request.emit (events.js:203:13)
at Request.<anonymous> (/Users/michaelcarey/workspace/apigee-demo/node_modules/request/request.js:1154:10)
at Request.emit (events.js:203:13)
at IncomingMessage.<anonymous> (/Users/michaelcarey/workspace/apigee-demo/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:291:20)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
While I think we could/should do client-side validation of this, I think this may be better solved by making the Management API handle this better. Let me file a bug internally and I can look into working around this on the client-side for now.