Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

feat: add fetch option to support cloudflare worker #21388

Closed
wants to merge 1 commit into from

Conversation

ZhengYuTay
Copy link

@ZhengYuTay ZhengYuTay commented Nov 22, 2021

Problem

Cloudflare workers unable to use XMLHttpRequest which cross-fetch use. fauna-db has this issue as well and added a fetch option to solve it. fauna/faunadb-js#207 (comment)

faunadb pr: https://github.com/fauna/faunadb-js/pull/214/files

Summary of Changes

Added a fetch option to Connection. I tested locally with cloudflare worker and it is able to fetch account info with Connection object

Fixes #

  1. cloudflare worker has its own fetch to use.
  2. cross-fetch has an old api for browser which cloudflare worker dont support, which is the XMLHttpRequest

@mergify mergify bot added the community Community contribution label Nov 22, 2021
@mergify mergify bot requested a review from a team November 22, 2021 14:49
@jstarry
Copy link
Contributor

jstarry commented Nov 24, 2021

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Nov 24, 2021

rebase

✅ Branch has been successfully rebased

@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #21388 (390b642) into master (8c5401e) will not change coverage.
The diff coverage is n/a.

❗ Current head 390b642 differs from pull request most recent head 446c7a5. Consider uploading reports for the commit 446c7a5 to get more accurate results

@@           Coverage Diff           @@
##           master   #21388   +/-   ##
=======================================
  Coverage    70.2%    70.2%           
=======================================
  Files          35       35           
  Lines        2066     2066           
  Branches      295      296    +1     
=======================================
  Hits         1451     1451           
  Misses        515      515           
  Partials      100      100           

@jstarry
Copy link
Contributor

jstarry commented Nov 24, 2021

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Nov 24, 2021

rebase

✅ Branch has been successfully rebased

@jstarry
Copy link
Contributor

jstarry commented Nov 24, 2021

@ZhengYuTay can you rebase your local changes off of master and then run the tests locally? They are failing with your changes

@ZhengYuTay
Copy link
Author

@jstarry I rebased and ran test locally for web3.js, seems fine

@ZhengYuTay
Copy link
Author

Seems that the CI trying to run npm run test:live but there is no such command?

@oJshua
Copy link
Contributor

oJshua commented Dec 3, 2021

Seems that the CI trying to run npm run test:live but there is no such command?

Looks like you may have removed cross-fetch which was assigned to fetch. https://github.com/solana-labs/solana/pull/21388/files#diff-374c0e9adc3dbbbed0df2a9f84a76e05ff454feb207888fd47e03cd64aa68cc5L3

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Jan 9, 2022
@stale
Copy link

stale bot commented Mar 2, 2022

This stale pull request has been automatically closed. Thank you for your contributions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Community contribution stale [bot only] Added to stale content; results in auto-close after a week.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants