workerd
workerd copied to clipboard
🐛 BUG: console.trace support (regression)
Which Cloudflare product(s) does this pertain to?
Wrangler core
What version(s) of the tool(s) are you using?
3.53.1
What version of Node are you using?
20.12.2
What operating system and version are you using?
Windows 11
Describe the Bug
console.trace
is a really nice method for logging within functions and getting a stack-trace back to see where and how something was called. In complex workers apps, this would be very helpful.
Reference: https://developer.mozilla.org/en-US/docs/Web/API/console/trace_static
Observed behavior
console.trace
calls are swallowed and log nothing.
Expected behavior
A trace should be logged, like in versions <= 3.14.0:
Trace: test
at logConsoleMessage (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:128126:25)
at WebSocket2.<anonymous> (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:127835:13)
at callListener (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:107228:18)
at WebSocket2.onMessage (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:107163:13)
at WebSocket2.emit (node:events:530:35)
at Receiver2.receiverOnMessage (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:108231:24)
at Receiver2.emit (node:events:518:28)
at Receiver2.dataMessage (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:106513:18)
at Receiver2.getData (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:106442:21)
at Receiver2.startLoop (C:\Users\james\AppData\Local\npm-cache\_npx\51f9f4bffffff67a\node_modules\wrangler\wrangler-dist\cli.js:106183:26)
(arguably not that useful since that's not userland code, but at least you get something)
Steps to reproduce
Using the following script:
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
console.trace('test');
return new Response('Hello world!');
},
};
-
npx [email protected] dev
- logs a trace -
npx [email protected] dev
- no trace, no error, just swallowed -
npx [email protected] dev
- no trace, no error, just swallowed
I previously opened this as a feature request at https://github.com/cloudflare/workers-sdk/issues/5761, but have since realised this is a regression.
Related: https://github.com/cloudflare/workerd/issues/2247