question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛 BUG: wrangler tail crashes when encountering a log from a Durable Object alarm invocation

See original GitHub issue

What version of Wrangler are you using?

2.0.22

What operating system are you using?

Linux (also happens on Mac)

Describe the Bug

Wrangler tail crashes if it gets sent a log from a DO alarm invocation. To repro:

  1. Deploy a DO that uses alarms, such as the example from https://blog.cloudflare.com/durable-objects-alarms/
  2. Start a wrangler tail session on that script
  3. Send a request to a DO that will cause an alarm to be run in the near future
  4. When the alarm finally runs, wrangler tail will print an error and exit.

The error I’ve been getting is:

/home/arobinson/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:16907
            throw ex;
            ^

TypeError: Cannot read properties of undefined (reading 'method')
    at WebSocket3.prettyPrintLogs (/home/arobinson/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:127428:54)
    at WebSocket3.emit (node:events:527:28)
    at Receiver2.receiverOnMessage (/home/arobinson/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:85301:24)
    at Receiver2.emit (node:events:527:28)
    at Receiver2.dataMessage (/home/arobinson/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:84002:18)
    at Receiver2.getData (/home/arobinson/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:83965:21)
    at Receiver2.startLoop (/home/arobinson/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:83820:27)
    at Receiver2._write (/home/arobinson/.npm/_npx/32026684e21afda6/node_modules/wrangler/wrangler-dist/cli.js:83777:14)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)

@xortive has pointed out that https://github.com/cloudflare/wrangler2/blob/main/packages/wrangler/src/tail/printing.ts “seems to assume all non-scheduled events are http and pukes when trying to pull the request method out”

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
a-robinsoncommented, Jul 26, 2022

It does not fail when using --json. Here’s an example:

{
  "outcome": "ok",
  "scriptName": "my-worker-name-here",
  "exceptions": [],
  "logs": [
    {
      "message": [
        "my message here"
      ],
      "level": "log",
      "timestamp": 1658843798477
    }
  ],
  "eventTimestamp": 1658843798474,
  "event": {
    "scheduledTime": "2022-07-26T13:56:38.473Z"
  }
}
0reactions
a-robinsoncommented, Aug 1, 2022

Perfect, works great!

Alarm @ 8/1/2022, 3:58:43 PM - Ok
  (log) [...]
Read more comments on GitHub >

github_iconTop Results From Across the Web

`wrangler tail` doesn't work when using Durable Objects
It seems that wrangler tail doesn't work in projects that also use Durable Objects. ... There is no error visible, just no logs...
Read more >
Wrangler gives confusing error when trying to use workers ...
Bug report Describe the bug When first publishing a worker, and subsequently using wrangler dev or wrangler publish fails - something ...
Read more >
Cloudflare Workers | Noise | Page 2
We configure Wrangler to upload these assets to Cloudflare and serve them from our ... Workers, Durable Objects, and Alarms are actually a...
Read more >
Untitled
Sueldo animador deportivo, Mthombeni primary school, John sitton talksport, Kino millstatt programm, Insect repellent for dogs, Mxon tv schedule, ...
Read more >
Untitled
Superbike crashes karak, Wciv live 5, Video beep effect, Baixar jogos de ps2 formato iso! Ducote designs! Clown furgone bianco torino, Connects auto...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found