-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Event Hubs] Circular dependencies from rhea-promise #27252
Comments
Do you happen to have an ESM version of @azure/event-hubs in the works? That would be the best solution in my opinion. |
@EskelCz We are packing ESM files too. Maybe for some reason the bundler was not using them? https://unpkg.com/browse/@azure/event-hubs@5.11.2/dist-esm/
|
@jeremymeng Nice, I'll give that a try. Why isn't there anything about it in the readme? Or is it documented somewhere else? Thanks |
When I try building it as ESM and import from @azure/event-hubs, I get this bundling error instead:
Again the issue seems to be the rhea-promise package. |
When thinking about it more in-depth, we probably don't need an SDK at all... all we need is something like five lines of code to send the https request from the front-end, with a domain whitelist in the back-end event hub. Is such a setup possible with event hubs? |
@EskelCz I am not aware of any HTTP/REST api to publish events to Event Hubs. Maybe Azure Functions' output binding could work for you? https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-output?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cfunctionsv2%2Cextensionv5&pivots=programming-language-javascript |
I am not sure why Rollup couldn't find it but rhea-promise has the type exported: https://unpkg.com/browse/rhea-promise@3.0.1/typings/lib/index.d.ts |
@jeremymeng Not sure, I'm not bundling it as typescript, so maybe the dependency is not compiled to javascript properly? |
This is a rhea promise issue. I opened amqp/rhea-promise#105 to break the cycles. |
@EskelCz that error is due to |
@deyaaeldeen @jeremymeng Thanks, that solves the build. But I was hoping for a much larger effect on the size of the bundle. It's still over 500 KB. Why do we need 14 703 lines of code to send a simple https request to the event hub from the front-end? |
@EskelCz Azure Event Hubs service does not use HTTP/HTTPS protocol. It uses AMQP thus our SDK requires AMQP supporting libraries (please see here for an overview: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-amqp-overview#amqp-10-technical-features) If all you need is to write some events to event hubs, the azure function output binding might be enough for you. I suppose that you can send HTTPS request to the azure function, which in turn writes to Event Hubs. https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-output?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cfunctionsv2%2Cextensionv5&pivots=programming-language-javascript EDITED: After some search, I see that the service does support some subset of functionalities through REST, but we don't have SDK support for that, so you would need to work with raw REST API https://learn.microsoft.com/en-us/rest/api/eventhub/event-hubs-runtime-rest |
@jeremymeng That's it, REST is just what I need. Thanks a lot. |
Describe the bug
When building for browser with Rollup, with the configuration from @azure/event-hubs documentation, I'm getting these two circular dependencies:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Build without errors
Additional context
I think it might be this issue: amqp/rhea-promise#47
The text was updated successfully, but these errors were encountered: