workerd icon indicating copy to clipboard operation
workerd copied to clipboard

🐛 Bug Report — Runtime APIs: service workers don't use Node-style logging

Open tommy351 opened this issue 7 months ago • 5 comments

Since v1.20231023.0, using console.log() in service worker throws the following exception.

workerd/util/symbolizer.c++:98: warning: Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set. To symbolize stack traces, set $LLVM_SYMBOLIZER to the location of the llvm-symbolizer binary. When running tests under bazel, use `--test_env=LLVM_SYMBOLIZER=<path>`.
workerd/jsg/util.c++:275: error: e = workerd/jsg/_virtual_includes/jsg/workerd/jsg/modules.h:533: failed: expected maybeModuleInfo != nullptr; No such module "; specifier = node-internal:internal_inspect; ".
stack: 1043a516b 1045bfe27 10439ab63 10439aadf 104f9b13f 104f99143 104f97107 104f96df7 10525c32f 10525bbb3 105147e2b 10413ee2b 10413ed8f 104652fd3 10464d783 1046cf6af 1045b4237 10458df63 1045b3fd3 1045b4843 105f09837 105f0a47b 105f116b7 105f0868b 1040bcd2b 1040c0317 1040c0153 1040c013b 105f719bf 105f71d07 105f70467; sentryErrorContext = jsgInternalError
workerd/io/worker.c++:1842: info: uncaught exception; source = Uncaught; exception = Error: internal error
workerd/io/io-context.c++:394: info: uncaught exception; exception = workerd/jsg/_virtual_includes/jsg/workerd/jsg/value.h:1334: failed: jsg.Error: internal error
stack: 104d8a6b3 10458e267 1045b3fd3 1045b4843 1045b4a3c 1045b4ee4
workerd/server/server.c++:2885: error: Uncaught exception: workerd/jsg/_virtual_includes/jsg/workerd/jsg/value.h:1334: failed: remote.jsg.Error: internal error
stack: 104d8a6b3 10458e267 1045b3fd3 1045b4843 1045b4a3c 1045b4ee4 1045b5ca4 1045b622c 104105b10 104ebee9c 104ebfe44 104ec0460 104e8ab88

Config

using Workerd = import "/workerd/workerd.capnp";

const config :Workerd.Config = (
  services = [
    (name = "main", worker = .mainWorker),
  ],

  sockets = [
    # Serve HTTP on port 8080.
    ( name = "http",
      address = "*:8080",
      http = (),
      service = "main"
    ),
  ]
);

const mainWorker :Workerd.Worker = (
  serviceWorkerScript = embed "console-log.js",
  compatibilityDate = "2023-02-28",
);

Script

addEventListener('fetch', event => {
  console.log('hello');
  event.respondWith(new Response('hello'));
});

tommy351 avatar Oct 30 '23 06:10 tommy351

Hey! 👋 Thanks for reporting. I'm able to reproduce this, and will take a look at fixing it today. 👍

mrbbot avatar Oct 30 '23 09:10 mrbbot

I am getting the same problem and i think it relates to this somehow https://github.com/cloudflare/workers-sdk/issues/3631

abdolrhman avatar Oct 30 '23 14:10 abdolrhman

is there any workaround? I am using vike (a vite application) and I'm also getting this error when serving a request

pencilcheck avatar Oct 31 '23 01:10 pencilcheck

Bump^ Same issue with 3.15.0, reverting to 3.14.0 fixes it

kinngh avatar Nov 12 '23 08:11 kinngh

Hey! 👋 As a quick update, we released [email protected] yesterday which upgrades to [email protected], and switches back to the old style of logging in service workers. This should fix this issue, but means the new, improved Node-style logging is only available for module workers at the moment. I'm going to leave this issue open until we've fixed this properly for service workers. Please let us know if you continue to have issues with logging. I would encourage you to migrate to module workers if you can though, as they have lots of other advantages. 😃

mrbbot avatar Nov 17 '23 14:11 mrbbot