-
Notifications
You must be signed in to change notification settings - Fork 294
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: WorkerEntrypoint wrapped with Proxy throws error when invoked #2291
Comments
Is there a way you can accomplish this without using a |
seems like what you're trying to do is kind of equivalent to applying a decorator to all the different RPC methods? |
Yeah, applying a decorator is essentially the goal. The It may be possible to accomplish this with JS decorators on the method level, though I would expect a class-level decorator to have the same problem and need a I'm also thinking that the next step is distributed tracing through RPC. That would need us to pass some OTEL data along with each RPC call. A decorator on the RPC method and another wrapping the bindings that provide RPC methods or stubs would be able to automatically inject and intercept that OTEL data. I haven't gotten that far yet, though I don't expect the outbound RPC call to have issues. Do you have any other suggestions for accomplishing this without a |
With a quick investigation this definitely would appear to be a bug either on our part or in v8. Will investigate further |
Should be fixed by #2406 in the next release. |
That's great! Thanks y'all! |
A
WorkerEntrypoint
class implementation that is wrapped in aProxy
throws the following runtime error when the service binding is invoked. This was created in a Worker with a service binding to its own entrypoint for testing.β [ERROR] workerd/io/worker.c++:1819: error: worker is not an actor but class name was requested; n = RpcEntrypoint
I found the error at the line below and attempted to trace how
WorkerEntrypoint
exports are determined. From what I understand, it should be detecting from__proto__
, though in the JS side this seems to be retained by the proxy wrapper. This is my first time digging through the workerd code though so I could be off track.workerd/src/workerd/io/worker.c++
Line 1819 in 92c30c9
Why proxy a WorkerEntrypoint?
I'm attempting the
Proxy
wrapper as a way to apply OpenTelemetry instrumentation to aWorkerEntrypoint
class. The proxy would extract the env form the constructor for configuration, wrap all RPC method invocations in spans, and export those spans automatically when the RPC method completes.The text was updated successfully, but these errors were encountered: