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

FEAT: Removing Mode for CloudFlare Workers #1452

Merged
merged 2 commits into from
Apr 3, 2023

Conversation

OLingard
Copy link
Contributor

Description

When trying to use Algolia's requester-fetch package combined with the algoliasearch method on Cloudflare workers, we get the error The 'mode' field on 'RequestInitializerDict' is not implemented.. For reference CF workers are ran in V8 Isolate and they have not added an implementation for mode on their fetch runtime.

Although it's not ideal that the behaviour of CloudFlare is to throw an error, we can avoid this issue by removing the mode field from the requester-fetch fetch options. The default mode is cors anyway so there is no functional change.

This issue has surfaced for multiple people as seen in this forum.

Reasons

I looked at the other request packages but they do not fit the bill.

  • requester-node-http: CF workers are ran in a browser environment not node
  • requester-browser-xhr: XMLHttpRequest is not implemented on CF workers.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 23, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7047b5f:

Sandbox Source
javascript-client-app Configuration

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR!

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ran everything locally and it works! thanks :D

@mglikesbikes
Copy link

mglikesbikes commented May 5, 2023

hello! wanted to ask a clarifying question: does this PR enable Cloudflare Workers 100%, no other workarounds etc?

Separately, noticed there's a new beta version of the JS library, will that include this fix or has the beta not necessarily been tested on Workers platform yet?

Thanks in advance!

@shortcuts
Copy link
Member

Hey!

hello! wanted to ask a clarifying question: does this PR enable Cloudflare Workers 100%, no other workarounds etc?

I believe so, but if not feel free to submit an issue and we would be more than happy to resolve it :)

Separately, noticed there's a new beta version of the JS library, will that include this fix or has the beta not necessarily been tested on Workers platform yet?

It have already been removed from the new beta version (v5), and the requester is exactly at the same stage as this one, however I don't know if people already tested it on workers

@mglikesbikes
Copy link

thanks so much!

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.

None yet

4 participants