Skip to content

feat(firestore): configure client to support 16MB documents#14684

Open
bhshkh wants to merge 2 commits into
googleapis:mainfrom
bhshkh:feat/fs-16mb
Open

feat(firestore): configure client to support 16MB documents#14684
bhshkh wants to merge 2 commits into
googleapis:mainfrom
bhshkh:feat/fs-16mb

Conversation

@bhshkh
Copy link
Copy Markdown
Contributor

@bhshkh bhshkh commented May 28, 2026

Configures the underlying gRPC client to explicitly support sending and receiving messages up to math.MaxInt32 bytes. This enables support for larger documents (up to 16MB) in the Go Firestore SDK.

Current Limits (Without this PR)

  • Receive Limit: Already configured to math.MaxInt32 in the auto-generated apiv1 client.
  • Send Limit: Not explicitly configured in the SDK. While the current grpc-go library implementation defaults to unlimited (math.MaxInt32) for client-side sending, explicitly setting it to math.MaxInt32 ensures robustness against future gRPC default changes and aligns with the expected behavior across other Firestore SDKs (which may have a 4MB default send limit).

Changes

This PR explicitly configures both MaxCallRecvMsgSize and MaxCallSendMsgSize to math.MaxInt32 in client.go to guarantee support for large payloads.

Also adds a regression test in integration_test.go:

  • TestIntegration_VerifyGRPCLimits: Verifies the client can send and receive a 5MB payload (exceeding the default 4MB gRPC limits) using non-compressible random bytes. It asserts that both the write (Set) and read (Get) operations succeed.

Fixes : b/452640794

@bhshkh bhshkh requested review from a team as code owners May 28, 2026 19:58
@product-auto-label product-auto-label Bot added the api: firestore Issues related to the Firestore API. label May 28, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures the Firestore client to support larger payloads by setting the gRPC maximum send and receive message sizes to math.MaxInt32 for both emulator and standard connections. It also introduces an integration test to verify these limits. Feedback on the changes suggests simplifying the test by removing the unnecessary error check for rand.Read, which is guaranteed to succeed.

Comment thread firestore/integration_test.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the Firestore API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants