question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[storage-blob] abstract class StorageClient is not exported

See original GitHub issue

The @azure/storage-blob v12 package doesn’t currently export the StorageClient abstract class from its entry point. This is causing a TypeScript compiler issue for one of our samples for the @azure/eventhubs-checkpointstore-blob package because it can’t find the protected pipeline member on a ContainerClient, which would be inherited from the StorageClient class.

Sample that causes the TypeScript error:

https://github.com/Azure/azure-sdk-for-js/blob/d66de696b7eb287b89fcd9284d6582077c0e7097/sdk/eventhub/eventhubs-checkpointstore-blob/samples/typescript/src/apiSpecificContainerClient.ts#L26-L48

Details

It looks like the api review tool is warning that StorageClient isn’t being exported: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/storage/storage-blob/review/storage-blob.api.md

// Warning: (ae-forgotten-export) The symbol “StorageClient” needs to be exported by the entry point index.d.ts

12.1.1 versus 12.1.2

It looks like StorageClient was never exported, however the above sample was working when using storage-blob up to version 12.1.1. It stopped working once upgrading to 12.1.2. The reason it stopped working seems to be that the way the types are distributed changed between these versions.

In 12.1.1, the types for each file were shipped with the package, so even though StorageClient wasn’t being exported from the index.ts file, the types for StorageClient were still shipped and the compiler could still find them.

In 12.1.2, the types are bundled up into a single file and exclude anything that’s not exported from the index.ts file. This means the types for StorageClient are no longer being shipped.

Fix types by exporting StorageClient

It seems like we should be exporting StorageClient from index.ts. api-extractor has actually been warning that it isn’t exported for a while, but due to the way we were shipping types prior to 12.1.2 the compiler was still able to find it. I’m not aware of a reason we would want to hide it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ramya-rao-acommented, Aug 3, 2020

Yes, lets use the newPipeline way.

0reactions
chradekcommented, Aug 4, 2020

Closing this since the type is exported and I was using a field that was marked @internal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@azure/storage-blob package | Microsoft Learn
Credential is an abstract class for Azure Storage HTTP requests signing. ... A StorageClient represents a based URL class for BlobServiceClient, ...
Read more >
Class StorageClient (4.1.0) | .NET client library | Google Cloud
This abstract class is provided to enable testability while permitting additional operations to be added in the future.
Read more >
storageclient class can't be found? - Stack Overflow
I'm getting the error Class 'Google\Cloud\Storage\StorageClient' not found. I'm using the gcloud console code editor and everything should ...
Read more >
Index (Microsoft Azure Storage Client SDK 8.0.0 API)
Could not verify the copy source within the specified time. changeLease(String, AccessCondition) - Method in class com.microsoft.azure.storage.blob.
Read more >
google-cloud Documentation - Read the Docs
Base error class for Google Cloud errors (abstract). ... environment variable to a non-empty string, e.g.: $ export ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found