Skip to content
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

fix: don't crash inside cloudflare workers #33

Merged
merged 1 commit into from
Dec 9, 2023

Conversation

threepointone
Copy link
Contributor

I noticed an error when trying to use the client from inside Cloudflare Workers/PartyKit. Specifically, this request fails https://github.com/fal-ai/serverless-js/blob/6ad41e1bfa5d0ee6e99d4d39f80a6c07a866f5ff/libs/client/src/request.ts#L40
because Cloudflare Workers doesn't support the mode field on fetch() calls. (More info cloudflare/workers-sdk#4159)

The fix here is to detect navigator.userAgent === 'Cloudflare-Workers' and add the mode field only when that condition is false.

Hope this helps!

@turbo1912
Copy link
Collaborator

thanks @threepointone !

@turbo1912 turbo1912 merged commit 6f95c65 into fal-ai:main Dec 9, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants