Skip to content

Conversation

@mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Oct 19, 2023

Fixes remix-run/remix#7616

What this PR solves / how to test:

As of #4072, whenever Wrangler connected to the V8 inspector, it would clear V8's internal buffer of log messages. This ensured only messages logged while the inspector was connected would be displayed. Unfortunately, we only connect to the inspector once the Worker has reported it's ready to receive connections. This meant any console.log()s during Worker startup wouldn't be displayed.

This change switches to clearing V8's buffer whenever we disconnect from the inspector instead, ensuring startup logs are shown. In particular, this should fix Remix's HMR, which relies on startup logs to know when the Worker is ready.

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

N/A

Author has included the following, where applicable:

Reviewer is to perform the following, as 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

Note for PR author:

We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label highlight pr review so future reviewers can take inspiration and learn from it.

@mrbbot mrbbot requested a review from a team as a code owner October 19, 2023 14:41
@changeset-bot
Copy link

changeset-bot bot commented Oct 19, 2023

🦋 Changeset detected

Latest commit: a51f57a

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 Oct 19, 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/6625281192/npm-package-wrangler-4235

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

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

Or you can use npx with this latest build directly:

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

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


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare 3.20231016.0 3.20231016.0
workerd 1.20231016.0 1.20231016.0
workerd --version 1.20231016.0 2023-10-16

|

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Merging #4235 (a51f57a) into main (980df04) will decrease coverage by 0.05%.
Report is 13 commits behind head on main.
The diff coverage is 17.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4235      +/-   ##
==========================================
- Coverage   75.41%   75.36%   -0.05%     
==========================================
  Files         223      223              
  Lines       12231    12259      +28     
  Branches     3161     3171      +10     
==========================================
+ Hits         9224     9239      +15     
- Misses       3007     3020      +13     
Files Coverage Δ
packages/wrangler/src/api/dev.ts 82.60% <ø> (ø)
packages/wrangler/src/dev.tsx 83.60% <100.00%> (+0.06%) ⬆️
packages/wrangler/src/dev/inspect.ts 5.27% <0.00%> (ø)
packages/wrangler/src/pages/dev.ts 16.26% <13.33%> (+0.14%) ⬆️

... and 8 files with indirect coverage changes

As of #4072, whenever Wrangler connected to the V8 inspector, it would
clear V8's internal buffer of log messages. This ensured only messages
logged while the inspector was connected would be displayed.
Unfortunately, we only connect to the inspector once the Worker has
reported it's ready to receive connections. This meant any
`console.log()`s during Worker startup wouldn't be displayed. This
change switches to clearing V8's buffer whenever we _disconnect_
from the inspector instead, ensuring startup logs are shown.
@mrbbot mrbbot force-pushed the bcoll/discard-logs-on-close branch from 9fd7ed3 to a51f57a Compare October 24, 2023 10:00
@mrbbot mrbbot merged commit 46cd2df into main Oct 24, 2023
@mrbbot mrbbot deleted the bcoll/discard-logs-on-close branch October 24, 2023 10:12
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.

wrangler 3.11.0 breaks Remix's HMR

2 participants