"CODE_MOVED for unknown code block" bug?

Weird one - just got this apropos of nothing - wasn't even sending requests to the worker, but it was running. Assume a bug?
No description
12 Replies
Mitya
MityaOP11mo ago
This is while running locally with --remote, incidentally.
MrBBot
MrBBot11mo ago
Hey! 👋 This message is safe to ignore, see https://github.com/cloudflare/workerd/issues/1472#issuecomment-1850322438. We'll make sure this gets hidden from logs. 👍
GitHub
Docker error: CODE_MOVED for unknown code block? · Issue #1472 · cl...
Running wrangler dev --port=8000 inside Docker with: /* eslint-disable */ import { Router } from 'itty-router' const router = Router() const routes = JSON.parse(ROUTES) const proxyTo = host...
Mitya
MityaOP11mo ago
Thanks for the reply. However in my case it led to all requests spitting out 400s. I had to restart Wrangler/the Worker and all was well again (requests then spat out 200s or whatever they were supposed to.)
MrBBot
MrBBot11mo ago
Hmmm ok, do you have code in your /misc/checkSession that could return a 400 response? Is it possible bad requests are being sent for another reason?
Mitya
MityaOP10mo ago
No - that endpoint returns either 200 or 401. I don't think it's any other part of my code as the problem went away when I restarted the worker. I'll post back here when it next happens and see what I can identify. @MrBBot Did some more digging thing. Definitely something up with Wrangler/CF. It seems to happen when my back-end is idle for a while i.e. receiving no requests. Apropos of nothing it then gives this error, and any subsequent requests give a 400. If I restart Wrangler, the problem goes away and all requests work again. Should I be worried about this happening on live workers, or is it only on local dev? I'm working with --remote active, so it is running on your network, even when developing.
MrBBot
MrBBot10mo ago
Thanks for the additional information. I wouldn't worry about this for live workers. Even with --remote, we still run a local instance of the workers runtime for proxying requests to the remote server, so I'm guessing these errors are coming from that. I'll see if I can find some time to reproduce this, but if you could put together a reliable reprodution that would be super helpful. 🙂
Mitya
MityaOP10mo ago
Thanks for the reply. As far as I can tell the repro steps are: - basic CF Worker example - I've attached my package.json and dev.toml - Leave Worker idle for some time - Console shows output I sent in previous message - Browser dev tools confirms it's getting unprocessable responses (see screenshot) - When right-clicking on one of those requests and choosing "Open in new tab", I get the attached error output
Mitya
MityaOP10mo ago
As previously mentioned, this persists until I quit the worker and restart it.
MrBBot
MrBBot10mo ago
Thanks again for the additional information. I was able to reproduce the 1031 error by leaving a wrangler dev --remote session open for a couple hours then sending a request to it. Speaking to a colleague, this is a known issue and something we have a plan for addressing as part of the work we're doing to rearchitect wrangler dev. Do you have a rough idea of how long you have to wait for this error to occur? I suspect it's less than 2 hours? For now, I know this isn't ideal, but I'd encourage you to restart wrangler dev --remote when this happens, or consider using the fully-local wrangler dev (without the --remote flag). I think the CODE_MOVED errors are unrelated to the 1301 errors, and can be safely ignored.
Mitya
MityaOP10mo ago
Hey, thanks for the update and glad to know the devs understand the issue and have a fix in mind. Yes it's definitely well south of 2 hours before the issue appears. Actually I can't run locally without the --remote flag, due to another issue I've raised and been discussing with one of your colleagues over here. It's a really weird one; basically, my Worker won't connect to my DB. (The thread says Heroku DB, but I've since tried it with an Azure-hosted DB and same issue.) The DB is totally open, i.e. no IP restrictions, and other (non-Worker) apps running on my machine, as well as installed DB clients, can connect to the DB fine. The only way round this is to use --remote with a Hyperdrive. Never a dull moment!
Mitya
MityaOP10mo ago
Here's another one for you (sorry!), just in case this one is unknown. This happens a lot, seemingly after code changes. It gets stuck on this, and I have to restart the worker.
No description
Shihmin Lee
Shihmin Lee9mo ago
Hi. I kept encountering the same issue repeatedly. I had to restart the local workers, but this is getting annoying as I have more workers running locally. Are there any workarounds for this issue?
No description
Want results from more Discord servers?
Add your server