Can not use Front Door URL for blob storage account in BlobServiceClient for React App
See original GitHub issue- Package Name: @azure/storage-blob
- Package Version: 12.2.0-preview.1
- Operating system:
- nodejs
- version:
- browser
- name/version: Google Chrome/Version 84.0.4147.105 (Official Build) (64-bit)
- typescript
- version: 3.9.6
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
We have an Azure Blob Storage Account
running behind Azure Front Door
to provide custom URL & improve traffic performance.
The react app ( scaffold from CRA), uses the @azure/storage-blob
for upload, download, list & delete operations using SASToken
.
The App runs fine when running with Blob URL
example - https://example.blob.core.windows.net appended with SASToken
.
However when it is replaced with Front Door
custom URL, BlobServiceClient
fails with error :
Error: Unable to extract accountName with provided information.
at getAccountNameFromUrl (utils.common.ts:556)
at BlobServiceClient.StorageClient (StorageClient.ts:79)
at new BlobServiceClient (BlobServiceClient.ts:444)
at BlobStorageService.init (BlobStorageService.ts:35)
To Reproduce Steps to reproduce the behavior:
- Create a Front Door entry for Blob Storage Account URL.
- Try to create
BlobServiceClient
as
const customFrontDoorURL = 'https://files.xyz.com';
const blobServiceClient = new BlobServiceClient(`${customFrontDoorURL}/${SASToken}`);
Expected behavior A valid service client is created.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
BlockBlobClient class - Microsoft Learn
Creates an instance of BlockBlobClient. This method accepts an encoded URL or non-encoded URL pointing to a block blob. Encoded URL string will...
Read more >Connecting to Azure blob storage from React using Azure ...
This is essentially telling Azure AD "hey, here's an app, at a specific set of URLs, that needs permissions to do things -...
Read more >Hosting a React JS single page application on Azure Blob ...
Lets see how we can fix this using Azure CDN and URL rewrite rules engine to find URLs that are not for files,...
Read more >Upload files from (Fast)API to Azure Blob Storage
When I use the method which the file passed to API is file: bytes= File() , the file type seems able to upload...
Read more >@azure/storage-blob - npm
Microsoft Azure Storage SDK for JavaScript - Blob. Latest version: 12.12.0, last published: 2 months ago. Start using @azure/storage-blob in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, @pritesha
Custom domain support has been released with @azure/storage-blob 12.2.0, welcome to have a try.
Thanks, Jiachen
Sorry I misread this part and thought about removing
accountName
. Yes I like this approach: removing validation of accountName and leave it empty in the case where it is not available.@pritesha other than patching our code manually I don’t know an easy workaround.