Open CezaryBD opened 3 months ago
@CezaryBD thanks for reporting the issue! It may be related to this issue https://github.com/Azure/azure-sdk-for-js/issues/4983
However, even if we had correct XML payload, this scenario wouldn't work in a secure environment either due to Azure Service Bus service not supporting CORS for the ATOM management API in browsers: https://github.com/Azure/azure-sdk-for-js/issues/4983
Hi @jeremymeng, thanks for quick response. What is the workaround or proposed solution? Our project's functionality relies on this API's method.
Hi @jeremymeng, thanks for quick response. What is the workaround or proposed solution? Our project's functionality relies on this API's method.
The CORS issue need support from the service team. But since you were able to send requests that means you already have a way around it?
Do you have to run the service bus code in the browsers? One alternative is to have a NodeJS backend to do that.
@CezaryBD there's an untested and unsupported way to switch to use fast-xml-parser
. It will increase the bundle size of your app.
cat '.\patches\@azure+core-xml+1.4.3.patch'
diff --git a/node_modules/@azure/core-xml/dist/browser/index.js b/node_modules/@azure/core-xml/dist/browser/index.js
index e3caeef..595f7fb 100644
--- a/node_modules/@azure/core-xml/dist/browser/index.js
+++ b/node_modules/@azure/core-xml/dist/browser/index.js
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
-export { stringifyXML, parseXML } from "./xml.js";
+export { stringifyXML, parseXML } from "../esm/xml.js";
export { XML_ATTRKEY, XML_CHARKEY } from "./xml.common.js";
//# sourceMappingURL=index.js.map
\ No newline at end of file```
I currently have no CORS issues whatsoever, but I do have issues that e.g. in the Microsoft Edge the payload generated looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entry
xmlns="http://www.w3.org/2005/Atom">
<updated>2024-09-03T06:39:22.891Z</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>
whereas generated for Firefox looks like in the original ticket.
Will there be a tested and supported way or do you completely stop supporting browsers?
Yes, I need to run Service Bus subscription creation code on our browser side, this is a critical part of our project's architecture. If I move it to our backend, what's the point of existence for this library?
If I move it to our backend, what's the point of existence for this library?
This package supports both browsers and NodeJS.
I'd thought I linked to this above but apparently, I linked to the same issue twice... Yes, this is a bug on only FireFox. We will look into it. https://github.com/Azure/azure-sdk-for-js/issues/11655
Describe the bug The bug is happening on Mozilla Firefox browser only (so far). It seems that while executing subscription creation, there is a problem with xml payload created only on Mozilla Firefox browser.
To Reproduce Steps to reproduce the behavior:
Response: 400 BAD_REQUEST Body: