You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Service Bus单用户无法创建订阅(Firefox兼容性问题)

Azure Service Bus订阅创建400错误(仅Firefox 115版本出现)

问题现象

  • 调用Azure Service Bus管理客户端的createSubscription方法创建Topic订阅时,仅Firefox 115版本用户收到400错误,错误响应:
<Error><Code>400</Code><Detail>The specified resource description is invalid. TrackingId:1e75e58c-e002-4092-b9e5-2d00c702d785_G12, SystemTracker:*name of my service bus*:Topic:*name of my topic*, Timestamp:2024-08-16T08:05:54</Detail></Error>
  • 其他浏览器(如Chrome)、手动在Azure门户创建订阅均正常,代码逻辑统一:
this._sbAdminClient.createSubscription( `myApp-${user}`, azureSubscriptionId, { autoDeleteOnIdle: 'PT1H', } )// {user}变量为仅含简单拉丁字符的字符串

排查对比结果

对比Chrome和Firefox发送的PUT请求XML内容,发现Firefox生成的XML不符合Service Bus API的Schema要求:

Chrome(正常请求)XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><entry xmlns="http://www.w3.org/2005/Atom"><content type="application/xml"><SubscriptionDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"><AutoDeleteOnIdle>PT1H</AutoDeleteOnIdle></SubscriptionDescription></content></entry>

Firefox(报错请求)XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><entry><updated>2024-08-28T09:36:15.430Z</updated><content type="application/xml"><SubscriptionDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><AutoDeleteOnIdle>PT1H</AutoDeleteOnIdle></SubscriptionDescription></content></entry>

Firefox请求的问题点:

  • <entry>标签缺失必填的xmlns="http://www.w3.org/2005/Atom"命名空间
  • <SubscriptionDescription>使用了错误的命名空间xmlns:i="http://www.w3.org/2001/XMLSchema-instance",而非官方要求的http://schemas.microsoft.com/netservices/2010/10/servicebus/connect
  • 多了不必要的<updated>节点

根因

Firefox 115版本中,Azure Service Bus客户端库的XML序列化逻辑存在兼容性问题,生成的请求XML不符合Service Bus API的校验规则,导致服务端返回"资源描述无效"的400错误。

解决方案

  1. 升级客户端库:检查当前使用的Azure Service Bus管理客户端版本,升级到最新稳定版,多数情况下这类浏览器兼容性问题会被修复。
  2. 手动构造请求:如果无法升级库,可绕过客户端自动序列化,手动构造符合Schema的XML请求:
    • 按照Chrome的XML格式构造请求体
    • 发送PUT请求到Service Bus API端点,设置请求头Content-Type: application/atom+xml;type=entry;charset=utf-8
  3. 临时规避:引导受影响用户切换至Chrome等其他浏览器完成操作。

内容的提问来源于stack exchange,提问作者Lazar Nikolic

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 16:40:14