apigee / apigee/apigeetool-node

deployproxy allows a `null` API name

Open
#187 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
91
Forks
91
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/commands/deployproxy.js, especially the proxy creation flow referenced in the stack trace, and reproduce the command with an empty -n value. Trace where the API name becomes part of the URL and revision request. Done means blank names are rejected with the expected message before a server request is made.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.