BlobServiceClient 无法通过连接字符串进行连接,未定义缓冲区
BlobServiceClient cannot connect by connection string, Buffer is not defined
我想在我的 React 网页中使用存储帐户。为此,我正在使用 BlobServiceClient
.
当我使用 SAS 连接字符串时
const blobServiceClient = BlobServiceClient.fromConnectionString("BlobEndpoint=...")
一切正常,但当我想切换存储帐户连接字符串时:
const blobServiceClient = BlobServiceClient.fromConnectionString("DefaultEndpointsProtocol=https;...")
我的页面卡住了。我的问题是,为什么我不能在 BlobServiceClient
?
中使用标准连接字符串
编辑:
来自控制台的错误:
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)
您 运行 出现此错误的原因是您正尝试从 JavaScript 应用程序(而不是 Node 应用程序)连接到您的存储帐户。基于帐户连接字符串的连接仅允许用于节点应用程序。
来自文档 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. ]
我想在我的 React 网页中使用存储帐户。为此,我正在使用 BlobServiceClient
.
当我使用 SAS 连接字符串时
const blobServiceClient = BlobServiceClient.fromConnectionString("BlobEndpoint=...")
一切正常,但当我想切换存储帐户连接字符串时:
const blobServiceClient = BlobServiceClient.fromConnectionString("DefaultEndpointsProtocol=https;...")
我的页面卡住了。我的问题是,为什么我不能在 BlobServiceClient
?
编辑:
来自控制台的错误:
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)
您 运行 出现此错误的原因是您正尝试从 JavaScript 应用程序(而不是 Node 应用程序)连接到您的存储帐户。基于帐户连接字符串的连接仅允许用于节点应用程序。
来自文档 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. ]