apigee / apigee/apigeetool-node
Issue in Create App Key function - when passing comma separated API products error is returned
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 91
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
Passing comma separated API product values while invoking Creat App key, below error is returned from associateKeySecret function.
Error:
Associate KeySecret result: {"code":"cps.kms.ApiProductDoesNotExist","message":"API Product [{apiproduct1},{apiproduct2}] does not exist for tenant [32e6baf6] and id [null]","contexts":[]}
Solution:
Below particular line of code (createappkey.js line number 106) is incorrect. Incoming api product string is assigned as is within square brackets without splitting which results in single string with comma separated api product value i.e.
['Bronze,Gold'] which ideally should be ['Bronze','Gold'] after splitting up.
var prods = opts.apiProducts;
if (typeof prods === 'string') {
prods = [prods];
}
Reference:
createApp.js line number 68 has same functionality where api products are split and stored into array. Need to apply same logic in createAppKey.js instead of directly assigning apiproduct string with in square brackets.
if(opts.apiProducts){
var split = opts.apiProducts.split(',')
split.forEach(function(s){
if(s && s.trim()!= '') {
app.apiProducts.push(s.trim())
}
})
}
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 createAppKey.js around line 106 and compare its apiProducts handling with createApp.js around line 68. Verify that comma-separated products are handled as individual values, then run the relevant existing tests or Create App Key flow to confirm the associateKeySecret error is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100