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

Issue in Create App Key function - when passing comma separated API products error is returned #202

Open
RitvijKacha71 opened this issue Jan 20, 2021 · 0 comments

Comments

@RitvijKacha71
Copy link

RitvijKacha71 commented Jan 20, 2021

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())
}
})
}

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

1 participant