dzuluaga / apigee-sdk-mgmt-api

A short JavaScript SDK for Apigee Management API
MIT License
3 stars 3 forks source link

getKVMsEnvironment method has a defect #9

Open rohanakar opened 3 years ago

rohanakar commented 3 years ago

/lib/apigee-sdk-mgmt-api.js method getKVMsEnvironment() makes this call => curl -X GET undefined/v1/organizations/undefined/environments/dev1/keyvaluemaps

as the variable apigee_profile passed to this function is of the form => /{'test' : {url_mgmt : 'https://api.enterprise.apigee.com', org : grunt.option('org'), env : grunt.option('env'), username : grunt.option('username'), password : grunt.option('password')}, env : grunt.option('env')},/

The variables accesed in this function are at wrong level based on the request object. trying to access apigee_profile[url_mgmt] instead of apigee_profile['test']['url_mgmt']

Please change
var apigeel = apigee_profile ; to var apigeel = apigee_profiles[apigee_profiles.env];

rohanakar commented 3 years ago

There was a PR closed for this issue. There the user has created wrong configuration file. This piece of code is used in https://github.com/grunt-apigee/grunt-apigee-kvm/blob/master/tasks/apigee_kvm.js .