fix(py-sdk): lowercase gRPC metadata headers for Python compatibility#359
fix(py-sdk): lowercase gRPC metadata headers for Python compatibility#359coding-shalabh wants to merge 1 commit intoMeesho:mainfrom
Conversation
…lity Python grpcio rejects metadata keys containing uppercase characters (HTTP/2 spec requires lowercase). The Go SDK works because Go's grpc library auto-lowercases keys, but Python's grpcio does not. Changed HEADER_CALLER_ID and HEADER_CALLER_TOKEN to lowercase to match the Go server middleware expectations in middleware.go. Fixes Meesho#165
PR Validation FailedPR description validation failed Issues found:
Please fill out the form to fix this: Open Form |
|
Links: Reason: 📘 Please check the Turbo Turtle FAQs for more details. 👉 If the reason is not self-explanatory or not covered in the FAQ, please reach out to @devops-oncall in the #devops-tech channel. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated gRPC authentication header constants from uppercase to lowercase format in the Python gRPC feature client. The changes modify two public header constants to use lowercase ASCII characters, aligning with HTTP/2 metadata requirements enforced by Python gRPC. Changes
Assessment against linked issues
Suggested labels
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required. |
erk1nya
left a comment
There was a problem hiding this comment.
Disregard previous approval - was automated test
🔁 Pull Request Template – BharatMLStack
Context:
Python gRPC clients fail with
metadata was invaliderror because header keys use uppercase characters, which violates HTTP/2 spec (RFC 7540 §8.1.2). Go's grpc auto-lowercases keys, but Python's grpcio rejects them.Describe your changes:
Lowercased
HEADER_CALLER_IDandHEADER_CALLER_TOKENconstants inpy-sdk/grpc_feature_client/grpc_feature_client/client.pyto match the Go server middleware expectations.Testing:
Verified header values match Go server middleware constants in
middleware.go. The fix is a constant value change — no logic changes.Monitoring:
NA
Rollback plan
Revert the two constant values back to uppercase.
Checklist before requesting a review
📂 Modules Affected
horizon(Real-time systems / networking)online-feature-store(Feature serving infra)trufflebox-ui(Admin panel / UI)infra(Docker, CI/CD, GCP/AWS setup)docs(Documentation updates)py-sdk✅ Type of Change
Root Cause
The Python SDK defined headers as:
Python
grpcioenforces RFC 7540 §8.1.2: header field names MUST be lowercase in HTTP/2. Go'sgrpc-goauto-lowercases metadata keys before sending, so the Go SDK works with uppercase constants. Python'sgrpciodoes not — it raises:Fix
These match the server-side constants in
online-feature-store/internal/server/grpc/middleware.go:Fixes #165