-
Notifications
You must be signed in to change notification settings - Fork 778
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
startDevWorker Milestone 1 - Reboot #4413
Conversation
🦋 Changeset detectedLatest commit: 7506c8f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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/6962539379/npm-package-wrangler-4413 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6962539379/npm-package-wrangler-4413 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6962539379/npm-package-wrangler-4413 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6962539379/npm-package-miniflare-4413 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6962539379/npm-package-cloudflare-pages-shared-4413 Note that these links will no longer work once the GitHub Actions artifact expires.
| Please ensure constraints are pinned, and |
261f092
to
e708f82
Compare
8e2f1ce
to
8b3c9b2
Compare
1348f52
to
ee9ac52
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## startDevWorker-release #4413 +/- ##
=========================================================
Coverage ? 75.48%
=========================================================
Files ? 240
Lines ? 12851
Branches ? 3309
=========================================================
Hits ? 9701
Misses ? 3150
Partials ? 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Nearly there... 😅 Added some comments.
|
||
type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; | ||
|
||
beforeEach(() => { | ||
devEnv = new DevEnv(); | ||
mf = undefined; | ||
res = undefined; | ||
res = undefined as any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having | undefined
in the res
type rather than as any
seems like a nicer solution here. Could we switch back to that and use runtime assertions/?.
where needed?
packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
Outdated
Show resolved
Hide resolved
e708f82
to
c569378
Compare
d6cad6b
to
b34416f
Compare
874b413
to
78c0b22
Compare
719e4f9
to
9b2ba1b
Compare
9b2ba1b
to
2931c48
Compare
c569378
to
e875506
Compare
mainly, base innerUrl off of request.url not userWorkerUrl
instead of UserWorker ip/port
using the MF-Disable-Pretty-Error header on the UserWorker request the ProxyWorker will still interpret the json error response depending on its own MF-Disable-Pretty-Error header
by trying to start on a random port
by removing --runInBand flag for jest
+ remove miniflare log.error overrides no longer needed
not logger.error/info
Co-authored-by: MrBBot <[email protected]>
2931c48
to
e82dbcd
Compare
* Revert "Revert "startDevWorker - Milestone 1" (#4171)" This reverts commit 88f15f6. * fix: don't show logs to ProxyWorker(s) unless log level is debug * fix: show console.log's in remote mode remote inspector websocket upgrade request required auth headers so use `fetch` with `Upgrade: websocket` header instead of `new WebSocket` * use miniflare verbose mode only if debug log level * use single Miniflare instance for (Inspector)ProxyWorker * port: clear remote runtime logs upon UserWorker restarts * default unstable_dev inspectorPort to 0 * parallelise cleanup to minimise chance of hanging previously, sequential cleanups fail to fully cleanup if earlier steps in the sequence fail * ensure InspectorProxyWorker unsafeDirectPort is set * don't use file-system for (Inspector)ProxyWorker DOs * prevent eviction of the Durable Objects with (Inspector)ProxyWorker * remove miniflare workaround for parallel requests * considerations for race between control messages and user fetches * use port: undefined vs 0 for UserWorker to force different port across reloads to workaround workerd bug on Windows * Don't try to parse `node-internal:* import specifiers * improve InspectorProxyWorker debug logs * only proxy consoleAPICalled events in remote mode * enable consoleAPICalled events proxying if local mode AND service-worker format * fix userWorkerInnerUrlOverrides host/hostname/port mainly, base innerUrl off of request.url not userWorkerUrl * use ProxyWorker ip/port for DEV_SERVER_READY event instead of UserWorker ip/port * always disable the UserWorker miniflare pretty error using the MF-Disable-Pretty-Error header on the UserWorker request the ProxyWorker will still interpret the json error response depending on its own MF-Disable-Pretty-Error header * recover from 'address in use' errors by trying to start on a random port * run unit tests in parallel again by removing --runInBand flag for jest * add handleRuntimeStdio option to ProxyWorker miniflare instance * expand containsHexStack check for windows * logger.debug runtime websocket errors from InspectorProxyWorker + remove miniflare log.error overrides no longer needed * log workerd warnings with logger.warn not logger.error/info * enable Cloudflare Access auth for remote previews * only send Runtime.discardConsoleEntries if currently connected to runtime --------- Co-authored-by: Samuel Macleod <[email protected]> Co-authored-by: MrBBot <[email protected]>
* Revert "Revert "startDevWorker - Milestone 1" (#4171)" This reverts commit 88f15f6. * fix: don't show logs to ProxyWorker(s) unless log level is debug * fix: show console.log's in remote mode remote inspector websocket upgrade request required auth headers so use `fetch` with `Upgrade: websocket` header instead of `new WebSocket` * use miniflare verbose mode only if debug log level * use single Miniflare instance for (Inspector)ProxyWorker * port: clear remote runtime logs upon UserWorker restarts * default unstable_dev inspectorPort to 0 * parallelise cleanup to minimise chance of hanging previously, sequential cleanups fail to fully cleanup if earlier steps in the sequence fail * ensure InspectorProxyWorker unsafeDirectPort is set * don't use file-system for (Inspector)ProxyWorker DOs * prevent eviction of the Durable Objects with (Inspector)ProxyWorker * remove miniflare workaround for parallel requests * considerations for race between control messages and user fetches * use port: undefined vs 0 for UserWorker to force different port across reloads to workaround workerd bug on Windows * Don't try to parse `node-internal:* import specifiers * improve InspectorProxyWorker debug logs * only proxy consoleAPICalled events in remote mode * enable consoleAPICalled events proxying if local mode AND service-worker format * fix userWorkerInnerUrlOverrides host/hostname/port mainly, base innerUrl off of request.url not userWorkerUrl * use ProxyWorker ip/port for DEV_SERVER_READY event instead of UserWorker ip/port * always disable the UserWorker miniflare pretty error using the MF-Disable-Pretty-Error header on the UserWorker request the ProxyWorker will still interpret the json error response depending on its own MF-Disable-Pretty-Error header * recover from 'address in use' errors by trying to start on a random port * run unit tests in parallel again by removing --runInBand flag for jest * add handleRuntimeStdio option to ProxyWorker miniflare instance * expand containsHexStack check for windows * logger.debug runtime websocket errors from InspectorProxyWorker + remove miniflare log.error overrides no longer needed * log workerd warnings with logger.warn not logger.error/info * enable Cloudflare Access auth for remote previews * only send Runtime.discardConsoleEntries if currently connected to runtime --------- Co-authored-by: Samuel Macleod <[email protected]> Co-authored-by: MrBBot <[email protected]>
What this PR solves / how to test:
This PR is for all changes made since Milestone 1 was first merged in #3960
Notable commits:
fetch
withUpgrade: websocket
header instead ofnew WebSocket
wrangler dev --remote
no longer logs? #4165bindings
shapeundefined
disables the inspector – we should implement a separate option to explicitly enable/disable the inspector in Miniflareworker.fetch
requests which are more likely to run into a race condition over the async http boundary than eye-ball requestsworkerd
instance on same port fromworkerd
fails withInternal Server Error
on Windows workerd#1376console.log()
ing workerd#1294console.log()
ing workerd#1294Author has addressed the following:
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.