workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

[BUG] console_log! in bound service crash service when called from parent service

Open omarabid opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What version of workers-rs are you using?

0.0.11

Describe the bug

As the title says. There are two services: Parent (is a regular TS worker) and the Child is a Rust WASM worker. The parent TS/JS calls the child worker through env.child.fetch after doing a service binding to the child worker.

This doesn't work when used with the log_request request function in the template repository. If you uncomment the line that calls the function, the service will function. Otherwise, you'll get the following error:

    {
      "name": "Error",
      "message": "The script will never generate a response.",
      "timestamp": 1666681187481
    }

Steps To Reproduce

I made a repo that reproduces this error: https://github.com/omarabid/rust-bound-worker

Calling the child service is always successful. Calling the parent process will fail with the error mentioned above is log_request is called. Removing log_request does fix the problem.

Line in question: https://github.com/omarabid/rust-bound-worker/blob/95e13db5b59f740605b2839fb49ba9390c80e3e8/child/src/lib.rs#L18

omarabid avatar Oct 25 '22 07:10 omarabid

This may be fixed in https://github.com/cloudflare/workers-rs/pull/256

samdenty avatar Dec 31 '22 23:12 samdenty

You can test it out with cargo install -q worker-build2 && worker-build2 --release in your [build] command =

samdenty avatar Dec 31 '22 23:12 samdenty