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

chore: update unenv dependency version #6920

Merged
merged 1 commit into from
Oct 9, 2024
Merged

chore: update unenv dependency version #6920

merged 1 commit into from
Oct 9, 2024

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Oct 8, 2024

What this PR solves / how to test

Update unenv - Pulled fixes are listed in the changeset

See unjs/unenv#314

Fixes #6684

Author has addressed the following

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: unenv update
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Changeset (Changeset guidelines)
    • TODO (before merge)
    • Changeset included
    • Changeset not necessary because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: unenv update

@vicb vicb added the e2e Run e2e tests on a PR label Oct 8, 2024
@vicb vicb requested a review from a team as a code owner October 8, 2024 08:03
Copy link

changeset-bot bot commented Oct 8, 2024

🦋 Changeset detected

Latest commit: 35d3113

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

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers 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

@vicb
Copy link
Contributor Author

vicb commented Oct 8, 2024

/cc @anonrig

Copy link
Contributor

github-actions bot commented Oct 8, 2024

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/11255696733/npm-package-wrangler-6920

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

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

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-wrangler-6920 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-create-cloudflare-6920 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-cloudflare-kv-asset-handler-6920
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-miniflare-6920
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-cloudflare-pages-shared-6920
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-cloudflare-vitest-pool-workers-6920
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-cloudflare-workers-editor-shared-6920
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11255696733/npm-package-cloudflare-workers-shared-6920

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


wrangler@3.80.2 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240925.1
workerd 1.20240925.0 1.20240925.0
workerd --version 1.20240925.0 2024-09-25

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

@petebacondarwin
Copy link
Contributor

The error in the nodejs-hybrid-app is:

[ERROR] service core:user:nodejs-hybrid-app: Uncaught TypeError: Cannot read properties of undefined (reading 'bind')

Building the worker to dist, then changing wrangler.toml to point to the compiled output and adding no_bundle = truegives the actual line that is failing:

addEventListener: performance3.addEventListener.bind(performance3),

So it appears that addEventListener is not defined

Elsewhere in the code we can see:

performance3 = globalThis.performance ?? new Performance2();

The fake Performance2 class has addEventListener() but it is not used because globalThis.performance is defined, and is missing that function.

From the docs performance is defined and only has now() and timeOrigin(). Confirmed in workerd source code.

So this polyfill is a bit broken for Cloudflare. I wonder if we need to be more fine grained about polyfilling that global?

@vicb
Copy link
Contributor Author

vicb commented Oct 8, 2024

Great analysis @petebacondarwin

So it appears that addEventListener is not defined

Elsewhere in the code we can see:

performance3 = globalThis.performance ?? new Performance2();

The fake Performance2 class has addEventListener() but it is not used because globalThis.performance is defined, and is missing that function.

unenv should inject the polyfill in the globalScope here. But it looks like this is not working.

Also unjs/unenv#318

@petebacondarwin petebacondarwin merged commit 2e64968 into main Oct 9, 2024
22 checks passed
@petebacondarwin petebacondarwin deleted the unenv branch October 9, 2024 15:07
@workers-devprod workers-devprod mentioned this pull request Oct 9, 2024
@vicb
Copy link
Contributor Author

vicb commented Oct 9, 2024

Thanks Pete!

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
Status: Done
Development

Successfully merging this pull request may close these issues.

🐛 BUG: mongodb can be imported but not successfully used with nodejs_compat_v2
3 participants