{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-sdk-for-node/issues/1703","repository_url":"https://api.github.com/repos/Azure/azure-sdk-for-node","labels_url":"https://api.github.com/repos/Azure/azure-sdk-for-node/issues/1703/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-sdk-for-node/issues/1703/comments","events_url":"https://api.github.com/repos/Azure/azure-sdk-for-node/issues/1703/events","html_url":"https://github.com/Azure/azure-sdk-for-node/issues/1703","id":148045990,"number":1703,"title":"Error Message : this._cache.find is not a function","user":{"login":"paritosh16","id":10785743,"avatar_url":"https://avatars.githubusercontent.com/u/10785743?v=3","gravatar_id":"","url":"https://api.github.com/users/paritosh16","html_url":"https://github.com/paritosh16","followers_url":"https://api.github.com/users/paritosh16/followers","following_url":"https://api.github.com/users/paritosh16/following{/other_user}","gists_url":"https://api.github.com/users/paritosh16/gists{/gist_id}","starred_url":"https://api.github.com/users/paritosh16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritosh16/subscriptions","organizations_url":"https://api.github.com/users/paritosh16/orgs","repos_url":"https://api.github.com/users/paritosh16/repos","events_url":"https://api.github.com/users/paritosh16/events{/privacy}","received_events_url":"https://api.github.com/users/paritosh16/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/azure-sdk-for-node/labels/IAAS","name":"IAAS","color":"DDDDDD"}],"state":"open","locked":false,"assignee":{"login":"amarzavery","id":4521223,"avatar_url":"https://avatars.githubusercontent.com/u/4521223?v=3","gravatar_id":"","url":"https://api.github.com/users/amarzavery","html_url":"https://github.com/amarzavery","followers_url":"https://api.github.com/users/amarzavery/followers","following_url":"https://api.github.com/users/amarzavery/following{/other_user}","gists_url":"https://api.github.com/users/amarzavery/gists{/gist_id}","starred_url":"https://api.github.com/users/amarzavery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amarzavery/subscriptions","organizations_url":"https://api.github.com/users/amarzavery/orgs","repos_url":"https://api.github.com/users/amarzavery/repos","events_url":"https://api.github.com/users/amarzavery/events{/privacy}","received_events_url":"https://api.github.com/users/amarzavery/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2016-04-13T12:34:55Z","updated_at":"2016-05-20T14:17:42Z","closed_at":null,"body":"I have used the `computeClient.virtualMachines.start` using [this](https://github.com/Azure/azure-sdk-for-node/blob/master/examples/ARM/compute/vm-sample.js) reference. Authentication is correct. The API call gives an error message that says `this._cache.find is not a function`\r\n\r\nThe code snippet looks like the following\r\n    \r\n    computeClient.virtualMachines.start('abc','xyz',function(err, result){\r\n      if(err) {\r\n        console.log(\"API error : \");\r\n        console.log(err);\r\n      } else {\r\n        console.log(\"API success : \");\r\n        console.log(result)\r\n      }\r\n    });\r\n\r\nIt doesn't even log error in the `if` block. The process snaps out right where the API call is made.\r\n\r\nNeed help on this as soon as possible."},"comment":{"url":"https://api.github.com/repos/Azure/azure-sdk-for-node/issues/comments/220618065","html_url":"https://github.com/Azure/azure-sdk-for-node/issues/1703#issuecomment-220618065","issue_url":"https://api.github.com/repos/Azure/azure-sdk-for-node/issues/1703","id":220618065,"user":{"login":"paritosh16","id":10785743,"avatar_url":"https://avatars.githubusercontent.com/u/10785743?v=3","gravatar_id":"","url":"https://api.github.com/users/paritosh16","html_url":"https://github.com/paritosh16","followers_url":"https://api.github.com/users/paritosh16/followers","following_url":"https://api.github.com/users/paritosh16/following{/other_user}","gists_url":"https://api.github.com/users/paritosh16/gists{/gist_id}","starred_url":"https://api.github.com/users/paritosh16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritosh16/subscriptions","organizations_url":"https://api.github.com/users/paritosh16/orgs","repos_url":"https://api.github.com/users/paritosh16/repos","events_url":"https://api.github.com/users/paritosh16/events{/privacy}","received_events_url":"https://api.github.com/users/paritosh16/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T14:17:42Z","updated_at":"2016-05-20T14:17:42Z","body":"I am using the following function to get the token.\r\n```\r\nfunction getAzureTokenId(callback) {\r\n  var adal=require('adal-node');\r\n  var AuthenticationContext= adal.AuthenticationContext;\r\n  var tenantID=\"tenant_Id\";\r\n  var clientID=\"client_Id\";\r\n  var resource=\"https://management.azure.com/\";\r\n  var authURL=\"https://login.windows.net/\" + tenantID;\r\n  var secret=\"application_secret\";\r\n  var context=new AuthenticationContext(authURL);\r\n  context.acquireTokenWithClientCredentials(resource, clientID, secret, function(err,tokenResponse) { \r\n    callback(tokenResponse);\r\n  });\r\n}\r\n```\r\nThe above function gives `tokenResponse` which is then used for obtaining the credentials.\r\n\r\n```\r\nvar credentials = new msRestAzure.ApplicationTokenCredentials(clientId, domainName, secret, { 'tokenCache': tokenResponse });\r\n```\r\n\r\nThe credentials are used to make the final API call for listing the Azure VMs\r\n\r\n```\r\nvar computeClient = new computeManagementClient(credentials, subscriptionId);\r\n    computeClient.virtualMachines.listAll(function(err, result){\r\n      if(err) {\r\n        console.log(\"List API error : \")\r\n        console.log(err.stack);\r\n      } else {\r\n        console.log(\"List API success : \")\r\n        console.log(result)\r\n      }\r\n    });\r\n```\r\n\r\nCould you please help me as to where the changes you mentioned should happen? My sense says that the `tokenCache` is returned by the function `acquireTokenWithClientCredentials` and I still have to figure out how to generate that token using the `MemoryCache()` approach that was suggested."}}
{"actor":{"display_login":"paritosh16"}}