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: do not crash in wrangler dev when passing a request object to fetch #2597

Merged

Conversation

petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Jan 23, 2023

What this PR solves / how to test:

This reverts and fixes the changes in #1769 which does not support creating requests from requests whose bodies have already been consumed.

Fixes #2562


To test you can simply run the fixtures/worker-app project:

npm run build
cd fixtures/worker-app
npx wrangler dev

Without the fix, one or both of the new lines in that fixture (added by this PR) will cause an error.

Associated docs issues/PR:

  • N/A

Author has included the following, where applicable:

  • Tests
  • Changeset

Reviewer has performed the following, where applicable:

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

Fixes # [insert issue number].

This reverts and fixes the changes in cloudflare#1769
which does not support creating requests from requests whose bodies have already been consumed.

Fixes cloudflare#2562
@petebacondarwin petebacondarwin requested a review from a team as a code owner January 23, 2023 22:43
@changeset-bot
Copy link

changeset-bot bot commented Jan 23, 2023

🦋 Changeset detected

Latest commit: 5982598

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

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/runs/3991214397/npm-package-wrangler-2597

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

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

Or you can use npx with this latest build directly:

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

@GregBrimble
Copy link
Member

Thank you @petebacondarwin !

@codecov
Copy link

codecov bot commented Jan 23, 2023

Codecov Report

Merging #2597 (5982598) into main (89d78c0) will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2597      +/-   ##
==========================================
+ Coverage   73.19%   73.23%   +0.03%     
==========================================
  Files         159      159              
  Lines        9847     9847              
  Branches     2622     2622              
==========================================
+ Hits         7208     7211       +3     
+ Misses       2639     2636       -3     
Impacted Files Coverage Δ
packages/wrangler/src/git-client.ts 81.25% <0.00%> (+4.16%) ⬆️
...ackages/wrangler/src/__tests__/helpers/mock-bin.ts 100.00% <0.00%> (+5.26%) ⬆️

@petebacondarwin petebacondarwin merged commit 416babf into cloudflare:main Jan 23, 2023
@github-actions github-actions bot mentioned this pull request Jan 23, 2023
@petebacondarwin petebacondarwin deleted the fix-checked-fetch-url branch June 28, 2023 12:03
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.

🐛 BUG: Cannot construct a Request with a Request object that has already been used
2 participants