Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: console error/warn messages aren't visible in the console when using local mode #1324

Closed
timabb031 opened this issue Jun 21, 2022 · 3 comments · Fixed by #1326 or #1336
Closed
Labels
bug Something that isn't working

Comments

@timabb031
Copy link
Contributor

What version of Wrangler are you using?

2.0.14

What operating system are you using?

Windows

Describe the Bug

This is a very minor issue that I noticed recently.

Given the following worker...

export default {
  async fetch(request) {
    console.debug("test debug");
    console.log("test log");
    console.info("test info");
    console.warn("test warn");
    console.error("test error");

    return new Response("Hello World!");
  },
};

If you run wrangler dev --local, only messages from the debug/log/info calls are output to the console (error/warn messages are missing).

⎔ Starting a local server...
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit                                    │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
[mf:inf] Worker reloaded! (337B)
[mf:inf] Listening on localhost:8787
[mf:inf] - http://localhost:8787
[mf:inf] Updated Request cf object cache!
test debug
test log
test info
GET / 200 OK (37.84ms)
test debug
test log
test info
GET /favicon.ico 200 OK (10.72ms)
⎔ Shutting down local server.

This issue appears to affect local mode only (i.e. wrangler dev without --local works fine).

@timabb031 timabb031 added the bug Something that isn't working label Jun 21, 2022
@petebacondarwin
Copy link
Contributor

I guess this is because, while we listen to and forward on data events from stdout, we only use the data event on stderr to find the Debugger listening... string; everything else just gets dropped.

https://github.com/cloudflare/wrangler2/blob/8e2b92f899604b7514ca977c9a591c21964c2dc9/packages/wrangler/src/dev/local.tsx#L248-L264

@timabb031
Copy link
Contributor Author

Ah right, yes that makes sense! Happy to submit a PR if you think it's worth changing / close the issue if not.

@petebacondarwin
Copy link
Contributor

Go for it @timabb031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants