我的应用程序的一个用户应该在特定主题中创建订阅,但无法这样做(所有其他用户都可以)。用户收到以下内容的错误:
<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>
除了该用户之外的其他人都可以成功运行的代码如下:
this._sbAdminClient.createSubscription(
`myApp-${user}`,
azureSubscriptionId,
{
autoDeleteOnIdle: 'PT1H',
}
)
// {user} variable here is just a simple string and it does contain only simple latin characters
需要明确的是,如果我检查 Azure 门户,该主题存在,并且如果我手动创建订阅,则接收器可以正常工作。
于2024年9月3日编辑
我的团队实际上发现这种情况只发生在 Mozilla Firefox 中。原因是 Chrome 中的
.createSubscription
方法在 PUT
有效负载中发送以下与官方架构相对应的 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>
但是在 Mozilla(版本 115)中,发送的 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>
这两个调用的 URL 相同:
https://ibit-lazarus-dev.servicebus.windows.net/{name of the subscription to be created}/Subscriptions/66d6bf8b925a793953574ac8?api-version=2021-05
在 Mozilla 中创建订阅失败的原因是 Azure 服务总线 SDK 在此浏览器中未按预期工作。也就是说,这是在基于 Chromium 的浏览器中可见的 XML 有效负载:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entry
xmlns="http://www.w3.org/2005/Atom">
<updated>2024-09-11T08:53:05.657Z</updated>
<content type="application/xml">
<SubscriptionDescription
xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AutoDeleteOnIdle>PT1H</AutoDeleteOnIdle>
</SubscriptionDescription>
</content>
</entry>
这是 Mozilla 中的:
<?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>
因此,
entry
标签内基于 Chromium 的浏览器中存在的属性在 Mozilla 中不存在,这会导致错误响应。
看起来与此问题相关:https://github.com/Azure/azure-sdk-for-js/issues/11655
另:https://github.com/Azure/azure-sdk-for-js/issues/30979