-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add Cloudflare worker support #766
Comments
I'm now testing the main branch including the webworker support added in #756. Importing the webworker version of Ably as follows does not trigger this problem anymore: However, initializing Ably.Realtime does: |
Hi @jcapogna, yeah this is expected; unfortunately the library still won't work in Cloudflare workers. It should now work in a regular webworker context but Cloudflare workers doesn't support |
Thanks @owenpearson. Do you know if this affects the REST client in addition to the Realtime client? |
Good suggestion @owenpearson. Using the REST API might not be too bad for my use case. |
I'm able to create token requests by using the Ably Rest client in Cloudflare Workers, you can see my code here: https://github.com/ben-xD/ably-cloudflare-workers I faced some quirks with cloudflare workers: mainly the handler passed as 2nd argument to
|
@ben-xD I'm able to do the same. I can use the Ably Rest client in a Cloudflare Worker to invoke The Rest client does not work when using it to retrieve channel history. At least in this example. The code:
Invoking
This seems like the other Cloudflare Worker problem you were having. I also tried the callback version of the Ably Rest client. That gave me the following error when calling
|
Do you have an async handler for |
I don't think that's the issue. Here's a repository where I've reduced it down to a minimal example of https://github.com/jcapogna/ably-cloudflare-worker-example/blob/master/src/handler.ts Note that I'm using ably-js 1.2.4. The latest version gave me other errors. |
I'm aware of the issues in #756 and I am using ably 1.2.3.
After downgrading from latest to 1.2.3, I am experiencing a different problem.
I am getting the following error when running
wrangler publish
:The minimal code required to trigger this error is importing Ably:
import * as Ably from "ably"
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: