Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storage] Change StorageSharedKeyCredential browser stub to class (Az…
…ure#8568) This fixes Azure#8499. The issue was that in StorageClient.ts we have the following check and assume that in browser scenario isNode would be false which would short-circuit the evaluation of factory instanceof StorageSharedKeyCredential. So we added an undefined const for browser stub of StorageSharedKeyCredential. ```typescript if ( (isNode && factory instanceof StorageSharedKeyCredential) || factory instanceof AnonymousCredential || isTokenCredential(factory) ) { this.credential = factory; } ``` However, in an Electron + Angular application, isNode is true but browser files are used. So the condition after && is evaluated and caused an error: ``` TypeError: Right-hand side of 'instanceof' is not an object at DataLakeServiceClient.StorageClient (StorageClient.js:35) at new DataLakeServiceClient (DataLakeServiceClient.js:39) ``` This fix changes the stub of StorageSharedKeyCredential to an empty class instead so the condition will not throw but be evaluated to false because this credential type is not supported in browser.
- Loading branch information