Hi,
I am having problems when trying to connect Azure Data Lake and see my ADL accounts.
Let me explain what I do and what happens after all.
- Open command pallet, then click ADL:Login option.
- Logging in from Azure portal using generated code in VSCode
- In VsCode, opening command pallate and calling ADL:ListAccounts
This command is returning me following message
[Info] Start listing Data Lake Analytics accounts...
[Info]
Then nothing is listed. Normally I would expect Azure Data Analytics account to be listed there. Not only this command was failing, Data Lake Explorer was showing my subscription fine but when I want to see the ADLA account, it was not working. Also I can not submit/compile any usql file.
At this point what I did is, as mostly suggested, I looked at the Developer tools.
In developer tools I found a error message as following.
As indicated in the error message, I found the authenticationManager.js file in the path which error message is referring to and following method in the file.
updateDatalakeServiceCredentials() {
if (AuthenticationManager.azureAccount.status == 'LoggedIn') {
AuthenticationManager.azureAccount.sessions.forEach(session => {
let tokens = session.credentials["tokenCache"]._entries;
let token = tokens.find(t => t.tenantId == session.tenantId);
console.log(`updateDatalakeServiceCredentials ${session.tenantId}, ${token.accessToken}`);
this.logger.debug(`updateDatalakeServiceCredentials ${session.tenantId}, ${token.accessToken}`
this.credentialAdd(session.tenantId, token.accessToken);
});
}
}
It was not super easy to debug this method, but with a lot of console.log(object), I got to know that following lines is the one causing an exception.
let tokens = session.credentials["tokenCache"]._entries;
let token = tokens.find(t => t.tenantId == session.tenantId);
in the first method tokens
is being assigned to null
and therefore find
function throws an error.
The reason why tokens
is being null
is because session.credentials["tokenCache"]
object does not have property _entries
When I log the session.credentials["tokenCache"]
to console, I noticed that expected _entries
array is not there. In fact, _entries
array is beneath target
property. Please check following screenshot.
Hence the code was throwing an exception. I don't know whether this is general bug or not. But once I changed all
session.credentials["tokenCache"]._entries;
into
session.credentials["tokenCache"].target._entries;
Everything started to work as expected. It was tedious problem because suddenly my development environment stopped working. I just wanted to share in case if it requires any action from on developer of this add-in.
Regards