avsaase
avsaase
CDCloudflare Developers
Created by avsaase on 4/9/2024 in #workers-help
Problems with wrangler when developing worker in Rust
I have a worker that's written in Rust and I'm trying to run it locally with npx wrangler dev. During compilation of my code I get this error
/home/alexander/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:29573
throw a;
^

ReferenceError: Cannot access 'entry' before initialization
at getDevReactElement (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:171671:11)
at FSWatcher.<anonymous> (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:171633:26)
at FSWatcher.emit (node:events:519:28)
at FSWatcher.emit (node:domain:488:12)
at FSWatcher.emitWithAll (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/chokidar/index.js:540:8)
at FSWatcher._emit (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/chokidar/index.js:632:8)
at listener (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/chokidar/lib/nodefs-handler.js:370:20)

Node.js v21.7.1
/home/alexander/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:29573
throw a;
^

ReferenceError: Cannot access 'entry' before initialization
at getDevReactElement (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:171671:11)
at FSWatcher.<anonymous> (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:171633:26)
at FSWatcher.emit (node:events:519:28)
at FSWatcher.emit (node:domain:488:12)
at FSWatcher.emitWithAll (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/chokidar/index.js:540:8)
at FSWatcher._emit (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/chokidar/index.js:632:8)
at listener (/home/alexander/.npm/_npx/32026684e21afda6/node_modules/chokidar/lib/nodefs-handler.js:370:20)

Node.js v21.7.1
After this, it looks like the process stops (I get a new blank line in my terminal) but actually it continues in the background and once it is finished get some more lines printed
[INFO]: Optional field missing from Cargo.toml: 'license'. This is not necessary, but recommended
[INFO]: ✨ Done in 2m 03s
[INFO]: 📦 Your wasm pkg is ready to publish at /home/alexander/work/simpl/simpl-energy/simpl-energy-api-v0/build.

shim.mjs 27.0kb

⚡ Done in 8ms
[INFO]: Optional field missing from Cargo.toml: 'license'. This is not necessary, but recommended
[INFO]: ✨ Done in 2m 03s
[INFO]: 📦 Your wasm pkg is ready to publish at /home/alexander/work/simpl/simpl-energy/simpl-energy-api-v0/build.

shim.mjs 27.0kb

⚡ Done in 8ms
At this point the server has not started and it looks like that never happens to I kill the program with ctrl + c. If I then run npx wrangler dev again, without making any changes to my code, the server starts correctly. The same problem happens when making changes to my code that require a recompilation.
1 replies
CDCloudflare Developers
Created by avsaase on 3/23/2024 in #workers-help
How can I find out if a request hit a new worker instance or one that was already warm?
I know there is supposedly no cold start time but when I package my Rust worker I get a warning that workers >1MB have higher cold starts. I do occasionally see longer response times of ~2 seconds and I want to find out if that's because of a cold start or something else.
2 replies