bun icon indicating copy to clipboard operation
bun copied to clipboard

Implement `performance.markResourceTiming`

Open kansson opened this issue 1 year ago • 2 comments

What version of Bun is running?

1.0.26+c75e768a6

What platform is your computer?

Darwin 23.2.0 arm64 arm

What steps can reproduce the bug?

Clone https://github.com/hanssonduck/wrangler-repo and install dependencies before starting the dev server with bun run dev and then open the app on http://localhost:5173.

What is the expected behavior?

The page should load without error.

What do you see instead?

TypeError: performance.markResourceTiming is not a function.

Additional information

Originally reported here https://github.com/cloudflare/workers-sdk/issues/4895.

kansson avatar Feb 12 '24 22:02 kansson

Any updates on this?

I'm running into this same issue using SvelteKit and @sveltejs/adapter-cloudflare.

jprinaldi avatar Apr 08 '24 01:04 jprinaldi

This issue blocks anything that depends on undici, which has 8,755,626 weekly downloads at the time of writing.

Updated to provide more useful information, old comment left for posterity Minimal reproduction for a common scenario: 1. Run `bunx wrangler -v` once (to mitigate `error: postinstall script from "esbuild" exited with 1`) 2. Run `bunx wrangler login` 3. Press "Allow" on permissions grant page to trigger the callback to Wrangler 4. Wrangler fails with `TypeError: performance.markResourceTiming is not a function. (In 'performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState)', 'performance.markResourceTiming' is undefined)`

Any time Cloudflare's Wrangler needs to get data from a callback URI, it will crash and burn. This is not ideal for local Workers development.

There may be other issues blocking Wrangler from running, but this is the most apparent.

overestimate avatar May 19 '24 04:05 overestimate

+1 this blocks adoption of bun for svelte based applications, which has gazillions of minutely downloads at the time of writing.

LazerJesus avatar Jun 20 '24 12:06 LazerJesus

temporary fix:

$ sed -i '/performance.markResourceTiming/d' shims.js

this removes the offending line. i run in in docker after build.

LazerJesus avatar Jun 20 '24 12:06 LazerJesus