You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: clarify gRPC server option ordering and service name usage (#2820)
* Initial plan
* docs: clarify gRPC server option ordering and service name usage
- Fix all examples to show Server option before Name option
- Add note explaining why option ordering matters
- Add new section on "Option Ordering Issue" in Common Errors
- Add new section on "Service Name vs Package Name" in Common Errors
- Update transport.md to show proper ordering with comment
Co-authored-by: asim <[email protected]>
* docs: refine comments based on code review feedback
- Clarify that Server ordering before Name is mandatory
- Remove confusing comment about Client ordering being for consistency
Co-authored-by: asim <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: asim <[email protected]>
Copy file name to clipboardExpand all lines: internal/website/docs/guides/grpc-compatibility.md
+50-8Lines changed: 50 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,12 +43,14 @@ import (
43
43
)
44
44
45
45
service:= micro.NewService(
46
-
micro.Name("helloworld"),
47
-
micro.Server(grpcServer.NewServer()),
46
+
micro.Server(grpcServer.NewServer()), // Server must come before Name
48
47
micro.Client(grpcClient.NewClient()),
48
+
micro.Name("helloworld"),
49
49
)
50
50
```
51
51
52
+
> **Important**: The `micro.Server()` option must be specified **before**`micro.Name()`. This is because `micro.Name()` sets the name on the current server, and if `micro.Server()` comes after, it replaces the server with a new one that has no name set.
If the gRPC server is working but your service has no name or is not being found in the registry:
274
+
275
+
**Cause**: The `micro.Server()` option is specified **after**`micro.Name()`.
276
+
277
+
When options are processed, `micro.Name()` sets the name on the current server. If `micro.Server()` comes later, it replaces the server with a new one that doesn't have the name set.
0 commit comments