Search code examples
javascriptazurefirefoxazureservicebusazure-sdk

One user cannot create subscription inside topic in Azure Service Bus (JavaScript)


One user of my aplication that should create subscription in a specific topic is unable to do so (all of the others can). User is getting error with the following content:

<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>

The code that is working successfully for everybody else but for this user is the following:

this._sbAdminClient.createSubscription(
                        `myApp-${user}`, 
                        azureSubscriptionId,
                        {
                            autoDeleteOnIdle: 'PT1H',
                        }
                    )
// {user} variable here is just a simple string and it does contain only simple latin characters

Just to be clear, if I check Azure portal, the topic exists and if I manually create subscription, then receiver works fine.

EDIT on 03.09.2024

My team actually discovered that this is happening only in Mozilla Firefox. The reason is that the .createSubscription method in Chrome for example is sending in PUT payload the following XML which corresponds with official schema:

<?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>

But in Mozilla (version 115) the sent XML looks like this:

<?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>

The URL is the same for both of these calls: https://ibit-lazarus-dev.servicebus.windows.net/{name of the subscription to be created}/Subscriptions/66d6bf8b925a793953574ac8?api-version=2021-05


Solution

  • The reason why it fails to create subscription in Mozilla is because the Azure Service Bus SDK is not working as expected in this browser. Namely, this is the XML payload that is visible in Chromium based browsers:

    <?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>
    

    And this is the one in 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>
    

    So the attributes present in Chromium based browsers inside the entry tag do no texist in Mozilla and this is causing an error response. Looks like it is related to this issue: https://github.com/Azure/azure-sdk-for-js/issues/11655 Also: https://github.com/Azure/azure-sdk-for-js/issues/30979