我遇到错误:
UnauthorizedError:无效签名:令牌具有无效签名
当我尝试从Azure的Kubernetes群集中运行的nodejs docker容器访问Azure Service Bus时。
有趣的是,在本地运行代码时,或者在开发笔记本电脑上的docker容器内部运行代码时,都没有收到此错误,但是,一旦将容器部署到K8群集中,我就会收到该错误。
我已验证K8群集机密文件中的服务总线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服务总线一起使用。
任何受到赞赏的帮助,建议或想法。
非常感谢您。
答案 0 :(得分:1)
在这种情况下,问题在于OP将SAS字符串传递到容器的方式