0

i want to use storage account in my react webpage. For that i am using BlobServiceClient.

When i am using SAS connection string

const blobServiceClient = BlobServiceClient.fromConnectionString("BlobEndpoint=...")

Everything works fine but when i want to switch for storage account connection string:

const blobServiceClient = BlobServiceClient.fromConnectionString("DefaultEndpointsProtocol=https;...")

my page stuck. My question is, why i can not use standard connection string in BlobServiceClient?

EDIT:

Error from console:

utils.common.ts:184 Uncaught (in promise) ReferenceError: Buffer is not defined
    at extractConnectionStringParts (utils.common.ts:184:22)
    at Function.fromConnectionString (BlobServiceClient.ts:386:28)
    at Component._fetchContainer (Component.tsx:107:53)
    at Component.componentDidMount (Component.tsx:46:20)
    at commitLifeCycles (react-dom.development.js:20663:24)
    at commitLayoutEffects (react-dom.development.js:23426:7)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
    at invokeGuardedCallback (react-dom.development.js:4056:31)
    at commitRootImpl (react-dom.development.js:23151:9)
0

1 Answer 1

1

The reason you are running into this error is because you are trying to connect to your Storage account from a JavaScript app (and not a Node app). Account connection string based connections are only allowed for Node apps.

From the documentation here:

Account connection string or a SAS connection string of an Azure storage account. [ Note - Account connection string can only be used in NODE.JS runtime. ]

Sign up to request clarification or add additional context in comments.

8 Comments

Okay, thanks, but im running my app in docker and i am using command npm config set "strict-ssl" false -g && yarn config set "strict-ssl" false -g && yarn install --frozen-lockfile --production=false && yarn start for starting it. I am not a frontend dev but is it not node js runtime? Frontend is written in REactJS
Is your code is running in Frontend (in your React App) or Backend (some API using Node)?
it is running in frontend
Yeah, then you can't use the full account connection string. You will need to use a SAS Token based connection string.
Gracias, there is a workaround to use connection string?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.