Repository navigation
feat(sdk): serve any named gRPC service - #1
Merged
Merged
Conversation
serve_service runs an arbitrary tonic Service + NamedService over the same spec-compliant transport as serve (mTLS or insecure, v1/v1alpha reflection, health keyed by the service's NAME, graceful shutdown); serve becomes a thin wrapper over it. The generated server's prost codec drops protobuf fields newer than the generated types, so a runtime that must forward request bytes verbatim (function-wasm's transparent proxy) needs its own codec - which requires registering its own service. serve_service gives such a server the spec transport without duplicating it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
serve_service, which runs an arbitrary tonicService+NamedServiceover the same spec-compliant transport asserve: mTLS from--tls-certs-dir(or--insecure), v1 and v1alpha gRPC server reflection, the gRPC health service reporting the service'sNAMEas serving, and graceful shutdown on SIGTERM/SIGINT.servebecomes a thin wrapper over it - no behavior change for existing users.Why
The generated
FunctionRunnerServiceServerhard-wires the prost codec, and prost drops protobuf fields newer than the generated types. A runtime that must forward request bytes verbatim - function-wasm's transparent proxy, where the wasm guest must see the caller's exact bytes including fields this SDK's vendored proto does not know yet - needs a raw-bytes codec, and therefore has to register its own service. Until now that meant duplicating the whole transport (TLS, health, reflection, shutdown) downstream;serve_serviceprovides the transport for any service.Also useful for wrapping the generated server for instrumentation.
Notes
servestill applies--max-recv-message-sizeto the generated server before delegating, andArgs::max_recv_message_sizecarries the flag for custom services to honor.Service+NamedServiceimpl end to end and checks routing and health under itsNAME. One find from writing it: tonic routes byNamedService::NAME, so a stand-in for the FunctionRunnerService must keep its service name - documented in the test.Slated for 0.3.0.