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

Invalid api key throwing unhandled Exception. #53

Open
sahithiYar opened this issue Nov 2, 2021 · 0 comments
Open

Invalid api key throwing unhandled Exception. #53

sahithiYar opened this issue Nov 2, 2021 · 0 comments

Comments

@sahithiYar
Copy link

when an invalid apiKey is sent to the query request of rally api, request.js file in dist folder of rally is throwing unhandled exception.

Below is the code in request.js => dorequestPromise =>

var result = _lodash2.default.values(body)[0];
if (result.Errors.length) {
reject(generateError(result.Errors));
} else {
resolve(result);
}

value of body variable:
{
message:null
status:'401'
url:'/slm/webservice/v2.0/userpermission'
}

so when the values of [0] is being picked, result is containing null and the next line trying to check Errors length on null is throwing exception.

Below is my code / repro code
restApi = rally({
apiKey: apikey, // invalid apikey
apiVersion: "v2.0",
server: "https://rally1.rallydev.com",
requestOptions: {
headers: {
"X-RallyIntegrationName": //correct value which work well with valid apikey
"X-RallyIntegrationVendor": //correct value which work well with valid apikey
"X-RallyIntegrationVersion": "1.0",
}, proxy: proxy //correct value which work well with valid apikey
,jar: true
}
});

restApi.query({
type: 'userpermission', //the type to query
start: 1, //the 1-based start index, defaults to 1
pageSize: 200, //the page size (1-200, defaults to 200)
limit: Infinity, //the maximum number of results to return- enables auto paging
fetch: ['Workspace', 'Name', 'Project', 'ObjectID', 'User'], //the fields to retrieve
scope: {}
}, function (error, result) {
})

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