workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

fix: infinite loop if spawning command fails in `pages dev`

Open Martin-Eriksson opened this issue 3 years ago • 5 comments
trafficstars

Closes #1544.

Martin-Eriksson avatar Jul 26 '22 00:07 Martin-Eriksson

🦋 Changeset detected

Latest commit: 35cdc79bb9f19556544085d2662fc461ca537495

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

changeset-bot[bot] avatar Jul 26 '22 00:07 changeset-bot[bot]

@cloudflare/pages Thoughts on testing this?

JacobMGEvans avatar Jul 26 '22 22:07 JacobMGEvans

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/7384601747/npm-package-wrangler-1546

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

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

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7384601747/npm-package-wrangler-1546 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7384601747/npm-package-miniflare-1546
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7384601747/npm-package-cloudflare-pages-shared-1546
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7384601747/npm-package-create-cloudflare-1546 --no-auto-update

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 workspace:* 3.20231030.4
workerd 1.20231030.0 1.20231030.0
workerd --version 1.20231030.0 2023-10-30

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

github-actions[bot] avatar Jul 26 '22 22:07 github-actions[bot]

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (10e267f) 75.17% compared to head (35cdc79) 75.22%. Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1546      +/-   ##
==========================================
+ Coverage   75.17%   75.22%   +0.05%     
==========================================
  Files         242      242              
  Lines       13017    13018       +1     
  Branches     3346     3346              
==========================================
+ Hits         9785     9793       +8     
+ Misses       3232     3225       -7     
Files Coverage Δ
packages/wrangler/src/pages/dev.ts 16.38% <0.00%> (-0.06%) :arrow_down:

... and 6 files with indirect coverage changes

codecov[bot] avatar Jul 26 '22 22:07 codecov[bot]

This will at least fail now:

$ npx https://prerelease-registry.developers.workers.dev/runs/2736122461/npm-package-wrangler-1546 pages dev -- a       
Need to install the following packages:
  https://prerelease-registry.developers.workers.dev/runs/2736122461/npm-package-wrangler-1546
Ok to proceed? (y) 
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
Running a...
/home/walshy/.npm/_npx/d11ffa3a744dd226/node_modules/wrangler/wrangler-dist/cli.js:12025
            throw ex;
            ^

Error: spawn a ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn a',
  path: 'a',
  spawnargs: []
}

Whereas before it hung:

$ git:(main) wrangler pages dev -- a
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
Running a...

So this is an improvement. We should probably have a proper error message for it though, once we have a nice message I'm happy to ship.

WalshyDev avatar Jul 26 '22 22:07 WalshyDev

LGTM but I think we could actually add a fixtures test to prove that this crashes rather than hanging.

petebacondarwin avatar Jan 12 '23 14:01 petebacondarwin

Reviving this, @WalshyDev does anyone in Pages want to pick this up?

JacobMGEvans avatar Jan 18 '23 15:01 JacobMGEvans

Let me see on Monday if anyone has some free cycles

@Skye-31 may also be interested

WalshyDev avatar Jan 20 '23 21:01 WalshyDev

Looks like this was already resolved in https://github.com/cloudflare/workers-sdk/pull/1628

petebacondarwin avatar Jan 02 '24 11:01 petebacondarwin