-
Notifications
You must be signed in to change notification settings - Fork 103
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
SDK with Cloudflare workers and Fetch API #645
Comments
@rodbs Thanks for opening this issue, and using Speech SDK. I've merged a fix for this into our repo removing the reference to XMLHttpRequest, is there a way you could pull and build the latest commit? (If not, shoot me a email at <my_username>(at)microsoft(dot)com and I'll send you binaries.) If you could check whether this unblocks you, it'd be much appreciated (and you'd get a shoutout in our next release notes :-) ). |
@glharper It's not working. I've buil it, and copied the new distrib folder to the
|
@rodbs I've created a branch removing the offending code, could you build and test again? |
@glharper No, I'm getting the same error (I've tried with remove-ocsp branch)
|
@rodbs I've updated the branch to remove the dependency on rsvp, please give it another shot, and thanks for testing this for us. :-) |
@glharper I don't get the error anymore, but I cannot make it work. I don't know why but when I run this code I don't get the promise resolved. There's no error message at all.
|
@rodbs Try using |
@glharper https://developers.cloudflare.com/workers/runtime-apis/fetch-event/#waituntil Here it's an explanation:
I think I need to enclose with a |
@rodbs Couldn't you declare the url variable outside the waitUntil, like:
|
@glharper |
@rodbs Also, you're using the sdk.SpeechSynthesizer(speechConfig, null) syntax, correct? The SDK connects to a websocket service, so there should be no Fetch happening. |
@glharper I've run two tests (I deleted the subscription key in the output) : first one with
and this one with a |
@rodbs The sdk is trying to connect to the websocket endpoint, but cannot. If the ws library weren't available, I'd expect similar "can't resolve"/"not a constructor" error messages as the ones you originally posted. My best guess is a network configuration issue between your Cloudflare instance and the wss://westeurope.tts.speech.microsoft.com endpoint. One thing to check is if westeurope.tts.speech.microsoft.com resolves a DNS address when you ping it from Cloudflare. Another is that the 443 port (for wss traffic) is not blocked on your side. Beyond that, you'll need to engage Cloudflare support and figure out why that connection is not happening. |
@glharper Btw, is there a way to ping over wss/ws? Is this code valid ? |
@rodbs To ping over wss, you have to establish a connection first, and it doesn't look like you're able to establish a connection with the wss://westeurope.tts.speech.microsoft.com endpoint yet. |
@glharper Yeap, I think you're right. I've posted the issue in Cloudflare but no reply yet. In the meantime, are you planning to publish these changes to avoid the |
@rodbs Our tentative timeline for the OCSP removal is 1.28.0 (expected beginning of May). If you need this in a versioned branch sooner, I can talk to our team about a 1.28-prerelease when we release 1.27 in a few weeks. |
@glharper Yeap, if it could be in a prerelease it'd be highly appreciated so that I can do more testing. Thanks! |
@glharper |
@rodbs |
@rodbs This change has been merged in master, if you're able to take a commit specific dependency. |
@glharper
But I'm getting this error when install (using yarn):
|
@glharper
But when deploying to Cloudflare I got this other error; it seems it doesn't like to download from git
Is there any workaround to deploy it? otherwise I guess I'd need to wait to the final release .... |
@glharper |
I've got this log when running the sdk in prod
I've tried several times and always get the same final error. (Websocket not ready) I'm using this code:
|
@rodbs This sounds a lot like a networking issue between Cloudflare and the endpoint. |
@glharper |
@rodbs FYI 1.28.0 is now available via npm |
@glharper |
@rodbs I'm closing this issue, as it's morphed beyond anything that the SDK itself can address. If you come up with any code-resolvable issues, feel free to open a new issue. Thanks again. |
If anyone else is coming up against the same problem, this seems to be an issue with Cloudflare workerd (see my comment here). There's an open PR which looks like it should fix this. |
hey @nmfisher, I tried your temp fix from the other thread:
which did make the errors go away fortunately but I still can't get the
vs how it usually looks when it's successful:
were you able to actually get text to convert to audio fine? |
@TowhidKashem yes this is working fine for me in production using I wouldn't expect any material difference between Functions and Pages Functions, so perhaps it's just some underlying issue with your use of the Azure SDK. Are you sure you are calling |
Ooof you know what I got it working, the issue was I forgot to add the credentials via the dashboard, I thought just adding them to |
When using this sdk with cloudflare workers I get this error:
[XMLHttpRequest is not defined](https://community.cloudflare.com/t/xmlhttprequest-is-not-defined/133866)
I understand it's due to the fact the sdk doesn't suport the
Fetch API
.Is it planned to support this API to use speech services sdk with Cloudflare workers?
Is there any way to make it work now with workers?
The text was updated successfully, but these errors were encountered: