c_g*_*ges 4 python azure-storage azure-functions azure-storage-explorer azurite
我正在本地从 VSCode 运行一个 Azure 函数,该函数将字符串输出到 blob。我正在使用 Azurite 来模拟输出 blob 容器。我的函数如下所示:
import azure.functions as func
def main(mytimer: func.TimerRequest, outputblob:func.Out[str]):
outputblob.set("hello")
Run Code Online (Sandbox Code Playgroud)
我的 function.json:
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "mytimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 * * * * *"
},
{
"name": "outputblob",
"type": "blob",
"dataType": "string",
"direction": "out",
"path": "testblob/hello"
}
]
}
Run Code Online (Sandbox Code Playgroud)
在 local.settings.json 中,我设置了"AzureWebJobsStorage": "UseDevelopmentStorage=true".
问题是,当我运行该函数并签入 Azure 存储资源管理器时,会创建容器 (testblob)(以及其他 2 个容器:azure-webjobs-hosts 和 azure-webjobs-secrets),但它是空的并且 Azure 存储资源管理器刷新时显示错误消息: 第一个参数必须是字符串类型或 Buffer、ArrayBuffer、Array 或类似 Array 的实例。Received undefined
该函数运行并且不返回任何错误消息。
当我使用队列而不是 blob 作为输出时,它可以工作,并且我可以在模拟队列存储中看到该字符串。
当我在 Azure 订阅中使用 Blob 存储而不是模拟的 Blob 时,它也能正常工作,会使用该字符串创建一个新的 Blob。
我尝试过以下方法:
"UseDevelopmentStorage=true"为模拟存储的连接字符串我不断收到相同的错误消息。
我在 Windows 11 上使用 Azure 存储资源管理器版本 1.25.0。
谢谢你的帮助!
看起来这是 Azure 存储资源管理器版本最新版本 (v1.25.0) 的一个已知问题,请参阅: https://github.com/microsoft/AzureStorageExplorer/issues/6008
最简单的解决方案是卸载并重新安装早期版本: https://github.com/microsoft/AzureStorageExplorer/releases/tag/v1.24.3