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

Refactor checkFetch from a separate method to a proxy around fetch #3497

Merged
merged 3 commits into from
Jun 21, 2023

Conversation

evanderkoogh
Copy link
Contributor

Fixes #3478

What this PR solves / how to test:

This PR makes it possible to locally test Workers where the global fetch object is proxied with a Javascript Proxy.
While this won't happen often in regular Workers, things like the Open Telemetry SDK do need that to intercept and instrument outgoing fetch calls.

Associated docs issue(s)/PR(s):

This does not change any externally observable behaviour, so no tests are needed.

Author has included the following, where applicable:

Reviewer is to perform the following, as applicable:

  • Checked for inclusion of a relevant changeset
  • Checked for creation of associated docs updates
  • Manually pulled down the changes and spot-tested

@evanderkoogh evanderkoogh requested review from a team as code owners June 20, 2023 09:08
@changeset-bot
Copy link

changeset-bot bot commented Jun 20, 2023

🦋 Changeset detected

Latest commit: f221a61

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5322410902/npm-package-wrangler-3497

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/3497/npm-package-wrangler-3497

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5322410902/npm-package-wrangler-3497 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5322410902/npm-package-cloudflare-pages-shared-3497

Note that these links will no longer work once the GitHub Actions artifact expires.

@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Merging #3497 (f221a61) into main (9fd12df) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3497      +/-   ##
==========================================
+ Coverage   75.18%   75.21%   +0.02%     
==========================================
  Files         183      183              
  Lines       11055    11054       -1     
  Branches     2904     2903       -1     
==========================================
+ Hits         8312     8314       +2     
+ Misses       2743     2740       -3     
Impacted Files Coverage Δ
packages/wrangler/src/bundle.ts 93.82% <ø> (-0.04%) ⬇️

... and 2 files with indirect coverage changes

@petebacondarwin petebacondarwin self-assigned this Jun 21, 2023
@petebacondarwin petebacondarwin added the e2e Run e2e tests on a PR label Jun 21, 2023
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Nice little feature @evanderkoogh.
I have pulled this down and tried it out locally. It appears to work as expected.
(@evanderkoogh - I note your GH profile still says you are a PM at Cloudflare!)

@petebacondarwin petebacondarwin merged commit c5f3bf4 into cloudflare:main Jun 21, 2023
12 of 20 checks passed
@github-actions github-actions bot mentioned this pull request Jun 21, 2023
lrapoport-cf pushed a commit that referenced this pull request Aug 11, 2023
…3497)

* refactor checkFetch from a separate method to a proxy around fetch

* Add changeset

* prettier with the right options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 BUG: checkedFetch does not support global fetch function which is Proxied
3 participants