console.log Errors When Using Worker Static Assets
Hello. I am creating a Worker + Assets application using worker static assets. However, when using static assets, console.log does not output logs correctly.
Even more strangely, sometimes the logs are output correctly, and sometimes they are not. I don't understand the difference between the two cases. One thing is certain: when I'm not using static assets, the logs are reliably output, but when I am using static assets, it's a matter of chance.
I'm guessing, but could this be related to the deployment process?
My repository is here:
https://github.com/calloc134/check-log-issue-worker-assets
My application ID is: a42770fb-7bad-405f-af9a-15f09e2cc8bb
Has anyone else experienced a similar bug?
GitHub
GitHub - calloc134/check-log-issue-worker-assets
Contribute to calloc134/check-log-issue-worker-assets development by creating an account on GitHub.
5 Replies
Oh, it turns out that my problem was caused by static assets. I checked for a long time but didn’t notice this reason.😭
https://discordapp.com/channels/595317990191398933/1352139129743343726
After I removed the static assets, the logs were displayed normally, so I can be sure that this is the cause of the problem.


Thank you.
I'm relieved to hear that someone else is encountering the same error. I also spent a whole day trying to identify this error. I've identified the cause, but I don't know how to solve it. Is this a problem with Cloudflare's infrastructure? Workers static assets are a new feature, so perhaps there are bugs like this. I'm eagerly awaiting a fix for this bug.
related
https://discord.com/channels/595317990191398933/1311326552666931270/1311326552666931270
https://discord.com/channels/595317990191398933/846453104382836766/1313115518374379542
I wonder if there's a lack of documentation/information for how logs like this work today. You will only see logs when your worker is invoked - if people hit
/index.html
for example, that won't show up in the logs at all right now.
This is because Assets runs ahead of your user worker by default. You can enable run_worker_first
in your assets config which'll always invoke your user worker, and then manually env.ASSETS.fetch
but then you'll pay for every request - even those for static assets.I had the same problem. On my worker, there was only a static html called "sub.html", so the request to "https://url/sub" would not show the log, that's right, because by default the Assets are checked before the Worker, but when the Assets could not be matched, the other requests processed by the Worker did not show the log, that's the problem, it should show