【Azure 应用服务】Storage Queue触发Azure Function时报错 The input is not a valid Base-64 string
问题描述
创建一个PowerShell脚本的Azure Function,触发方式为 Storage Queue。但执行函数结果一直失败 (Failed).
错误消息为:
Executed 'Functions.QueueTrigger1' (Failed, Id=..., Duration=30ms) The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
Funciton 代码:
# Input bindings are passed in via param block.
param([string] $QueueItem, $TriggerMetadata) # Write out the queue message and metadata to the information log.
Write-Host "PowerShell queue trigger function processed work item: $QueueItem"
Write-Host "Queue item expiration time: $($TriggerMetadata.ExpirationTime)"
Write-Host "Queue item insertion time: $($TriggerMetadata.InsertionTime)"
Write-Host "Queue item next visible time: $($TriggerMetadata.NextVisibleTime)"
Write-Host "ID: $($TriggerMetadata.Id)"
Write-Host "Pop receipt: $($TriggerMetadata.PopReceipt)"
Write-Host "Dequeue count: $($TriggerMetadata.DequeueCount)"
通过向Storage Queue中添加消息时候触发:
az storage message put --content "This is a function test message"
问题分析
根据错误消息,Function (Storage Queue)触发的消息需要 Base64编码,如发送 "This is a function test message" 这段消息,需要在发送消息时候转换为base64编码。

在CMD中调用PowerShell进行类型转换:
powershell "[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"This is a function test message\"))"
在Powershell中直接转换:
[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("This is a function test message"))
所以,修改后的向Storage Queue中添加消息的命令为:
$queuemsg = [convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("This is a function test message"))
az storage message put --content $queuemsg
参考资料
适用于 Azure Functions 的 Azure 队列存储触发器: https://docs.azure.cn/zh-cn/azure-functions/functions-bindings-storage-queue-trigger?tabs=powershell#encoding
【Azure 应用服务】Storage Queue触发Azure Function时报错 The input is not a valid Base-64 string的更多相关文章
- 【Azure 应用服务】部署Kafka Trigger Function到Azure Function服务中,解决自定义域名解析难题
问题描述 经过前两篇文章,分别使用VM搭建了Kafka服务,创建了Azure Function项目,并且都在本地运行成功. [Azure Developer]在Azure VM (Windows) 中 ...
- Azure File Storage 基本用法 -- Azure Storage 之 File
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure Blob Storage 基 ...
- Azure Blob Storage 基本用法 -- Azure Storage 之 Blob
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure Table storage ...
- Azure Table storage 基本用法 -- Azure Storage 之 Table
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table,其中的 Table 就是本文的主角 Azure Tabl ...
- 【Azure 应用服务】App Service/Azure Function的出站连接过多而引起了SNAT端口耗尽,导致一些新的请求出现超时错误(Timeout)
问题描述 当需要在应用中有大量的出站连接时候,就会涉及到SNAT(源地址网络转换)耗尽的问题.而通过Azure App Service/Function的默认监控指标图表中,却没有可以直接查看到SNA ...
- 使用版本 1.0.0 的 Azure ARM SDK for Java 创建虚拟机时报错
问题描述 我们可以通过使用 Azure ARM SDK 来管理 Azure 上的资源,因此我们也可以通过 SDK 来创建 ARM 类型的虚拟机,当我们使用 1.0.0 版本的 Azure SDK fo ...
- 【Azure 应用服务】探索在Azure上设置禁止任何人访问App Service的默认域名(Default URL)
问题描述 总所周知,Azure App Service服务会默认提供一个 ***.chinacloudsites.cn为后缀的域名,但是该域名由上海蓝云网络科技有限公司备案,仅用于向其客户提供 Azu ...
- hive udaf 用maven打包运行create temporary function 时报错
用maven打包写好的jar,在放到hive中作暂时函数时报错. 错误信息例如以下: hive> create temporary function maxvalue as "com. ...
- 【Azure 应用服务】本地创建Azure Function Kafka Trigger 函数和Kafka output的HTTP Trigger函数实验
问题描述 在上一篇博文(https://www.cnblogs.com/lulight/p/16525902.html)中,我们成功的以VM作为Kafka服务器运行,并且验证了从其他机器中远程访问.在 ...
- 远程访问Function时报错Remote table-valued function calls are not allowed.
开始是这样调用的:select * from [LinkedServer].[db name].dbo.[function name](param1, param2) 原因: Only table-v ...
随机推荐
- file文件转为base64
场景描述 在工作中,我们经常需要进行文件上传. 比如在进行图片上传的时候, 我们需要将上传的图片展示出来. 这个时候我们就需要将file文件转化为base64. 将file文件转化为base64 // ...
- 文件上传change事件只执行一次的问题
参考地址:https://blog.csdn.net/john_xiaoweige/article/details/81392110 本节中的注意点: this.$refs.attenceInput. ...
- IConfigurationSectionHandler 接口的用法
今天终于花了点时间了解一下IConfigurationSectionHandler 接口的用法 ,引以入门.首先建立一 RobsunConfigSectionHandler 专案,代码如下 : nam ...
- Leetcode 42题 接雨水(Trapping Rain Water) Java语言求解
题目链接 https://leetcode-cn.com/problems/trapping-rain-water/ 题目内容 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱 ...
- 从零开始配置 vim(9)——初始配置
虽然本系列文章叫做从0开始配置vim,似乎我们从一开始就要写vimrc配置文件,但是我们并没有这么做.我们先经过几篇文章了解了下面的几个内容 如何设置vim属性,从而改变vim的特征 配置快捷键,以提 ...
- 【Jmeter】按比例分配Api压测
先看 [Jmeter]基础介绍-详细 [Jmeter]Request1输出作为Request2输入-后置处理器 继续聊提出的第二个问题,即 2.需要按比例分配API请求并发,以模拟真实的API压力场景 ...
- 如何使用 etcd 实现分布式 /etc 目录
etcd 是一款兼具一致性和高可用性的键值数据库,简单.安全.快速.可信,目前是 Kubernetes 的首要数据存储.我们先来看一段 etcd 官方对于名字的解释. The name "e ...
- IntelliJ IDEA 在电脑上安装多个JDK 切换的方法
在电脑上来回切换多个版本的JDK进行开发,方法很简单: 1.下载jdk 下载的时候不要下载安装包,而是下载zip包,这样直接解压就可,不污染注册表,难引起其他问题 2.解压后 把JDK配置到IDEA里 ...
- Windows、MacOs上 gif 录像软件 LICEcap
LICEcap 官网:https://www.cockos.com/licecap/ 适用于 windows macos 我自己保持的一版,下载地址:https://files-cdn.cnblogs ...
- Go语言的100个错误使用场景(30-40)|数据类型与字符串使用
目录 前言 4. 控制结构 4.1 忽视元素在range循环中是拷贝(#30) 4.2 忽略在 range 循环中如何评估表达式(#31) 4.3 忽略在 range 中使用指针元素的影响(#32) ...