Azure 服务总线未经授权错误 : InvalidSignature: The token has an invalid signature inside Kubernetes cluster

标签 azure docker kubernetes azureservicebus azure-servicebus-topics

我收到错误:

UnauthorizedError: InvalidSignature: The token has an invalid signature

当我尝试从 Azure 中的 Kubernetes 集群内运行的 Nodejs docker 容器访问 Azure 服务总线时。

有趣的是,当我在本地运行代码或在我的开发笔记本电脑上的 docker 容器内运行代码时,我不会收到此错误,但一旦我将容器部署到 K8 集群,我就会收到此错误。

我验证了 K8 集群 secret 文件中的服务总线 SAS 主键是正确的。

以下是错误对象在 K8 集群内的样子:

UnauthorizedError: InvalidSignature: The token has an invalid signature. {"timestamp":"2019-01-08T05:43:48.918Z"}
debug: condition: com.microsoft:auth-failed {"timestamp":"2019-01-08T05:43:48.920Z"}
debug: info: undefined {"timestamp":"2019-01-08T05:43:48.920Z"}
debug: message: InvalidSignature: The token has an invalid signature. {"timestamp":"2019-01-08T05:43:48.924Z"}
debug: name: UnauthorizedError {"timestamp":"2019-01-08T05:43:48.924Z"}
debug: retryable: false {"timestamp":"2019-01-08T05:43:48.924Z"}
debug: stack: UnauthorizedError: InvalidSignature: The token has an invalid signature.
    at Object.translate (/usr/src/app/node_modules/@azure/amqp-common/dist/lib/errors.js:527:17)
    at Receiver.messageCallback (/usr/src/app/node_modules/@azure/amqp-common/dist/lib/requestResponseLink.js:109:44)
    at Receiver.emit (events.js:182:13)
    at emit (/usr/src/app/node_modules/rhea-promise/dist/lib/util/utils.js:129:24)
    at Object.emitEvent (/usr/src/app/node_modules/rhea-promise/dist/lib/util/utils.js:140:9)
    at Receiver._link.on (/usr/src/app/node_modules/rhea-promise/dist/lib/link.js:249:25)
    at Receiver.emit (events.js:182:13)
    at Receiver.link.dispatch (/usr/src/app/node_modules/rhea/lib/link.js:59:37)
    at Incoming.on_transfer (/usr/src/app/node_modules/rhea/lib/session.js:360:22)
    at Session.on_transfer (/usr/src/app/node_modules/rhea/lib/session.js:736:19) {"timestamp":"2019-01-08T05:43:48.925Z"}
debug: translated: true {"timestamp":"2019-01-08T05:43:48.925Z"}

我正在使用@azure/service-bus作为与 azure 服务总线配合使用的节点包。

非常感谢任何帮助、建议或想法。

非常感谢您。

最佳答案

在本例中,问题在于 OP 将 SAS 字符串传递到容器的方式

关于Azure 服务总线未经授权错误 : InvalidSignature: The token has an invalid signature inside Kubernetes cluster,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54086090/

相关文章:

azure - 从 Blazor 客户端中长时间运行的后台任务中释放 UI 的推荐方法是什么

Docker Compose - 将标识符添加到网络名称

apache - 使用Stackdriver在Kubernetes集群中使用日志创建自定义Docker容器

kubernetes - 如何获取 StatefulSet Kubernetes 的副本数

azure - 如何通过动态资源分配来运行spark + cassandra + mesos (dcos)?

Azure 广告 B2C session 不会过期

node.js - 在 Azure Web App 上的 iisnode 上运行 Next.js 时出现问题

shell - 使用 Docker Compose 的交互式 shell

python - 无法从docker-compose生成django.po文件

docker - 是否可以在不在云端的情况下私​​下使用 Google 容器?