Console.log doesn't work

For Workers & Pages, what is the name of the domain?

Development page

What is the error number?

No number, console.logs don’t show up on Log panel

What is the issue or error you’re encountering

I can’t get a console.log to consistently show up from a nextjs application running within a cloudflare worker.

What steps have you taken to resolve the issue?

wrangler.json file is:
{

“observability”: {
“enabled”: true,
“logs”: {
“enabled”: true
}
}
}

Console.logs work intermittently. I got some logs hours ago, but nothing since despite dozens of errors that are calling console.log(…)

What are the steps to reproduce the issue?

Repeatedly trigger server actions that call console.log(…)
Nothing shows up on Logs panel.

1 Like

Having the same issue, it’s really random. Sometimes I get a couple of logs, but most of the time just nothing. wrangler tail is also silent.

I’ve even created a new empty worker project and there it doesn’t work either.

1 Like

It seems to be related somehow to Assets functionality.
If I remove “assets” from wrangler.jsonc and re-deploy - logs start to work, but I want my assets though :melting_face:

See this issue: Cloudflare workers logs don't work when assets directory is set

1 Like

The problem is driving me crazy. I don’t know how I can be the only person encountering this issue. I first noticed it on a project I ported to Workers, then tried it on the Cloudflare-generated nextjs template page. Same issue. I thought maybe the site was cached, but I made the page force-dynamic with a console.log() right in the main page response. Nothing to logs. Arg!

I was excited to give Workers a try, but not being able to get logs is a total showstopper.

Same, I could find anything either, and was sure I was just doing something wrong. It’s like core functionality, but it’s completely broken.

After some digging I’ve also found a GitHub issue, but really that’s about it, it almost feels like nobody is using workers in production…

1 Like

There’s a known bug right now where with Assets enabled on a free account, that Workers logs don’t always show up. cc @Walshy

I’m not sure if there’s a public report or timeline on fix yet.

1 Like

Yes known bug, issue is identified and will be fixed soon.

4 Likes

Thank you all.
Marking this thread as solved.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.