feat: accept Expression for v2 RTDB instance option#1869
Open
IzaakGough wants to merge 10 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances Realtime Database (RTDB) ReferenceOptions to allow Expression<string> for the instance property, enabling dynamic resolution of instance names. The getOpts utility function has been updated to process these expressions, and a new test case validates this functionality. The review suggests improving the new test case by replacing magic strings with named constants for better readability and maintainability.
added 3 commits
April 9, 2026 17:11
…ams' into @invertase/fix-rtdb-instance-params
CorieW
reviewed
May 14, 2026
cabljac
requested changes
Jun 25, 2026
| const event = raw as RawRTDBCloudEvent; | ||
| const instanceUrl = getInstance(event); | ||
| const params = makeParams(event, pathPattern, instancePattern) as unknown as ParamsOf<Ref>; | ||
| const resolvedInstancePattern = resolveInstancePattern(instancePattern); |
Contributor
There was a problem hiding this comment.
some duplication here, can we clean up
cabljac
reviewed
Jun 25, 2026
| event, | ||
| pathPattern, | ||
| resolvedInstancePattern | ||
| ) as unknown as ParamsOf<Ref>; |
Contributor
There was a problem hiding this comment.
is this casting necessary - can we double check
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.
Fixes #1613
Summary
Allow the v2 Realtime Database trigger
instanceoption to accept a deploy-time param (Expression<string>), not just a plain string.This lets functions target different RTDB instances per environment without triggering the deployment-time
.value()warning.Problem
ReferenceOptions.instancewas typed and handled as a plainstring.Passing
defineString('REALTIME_INSTANCE')forinstanceeither failed type-checking or caused the SDK to eagerly resolve the param during deploy, which emitted the standard.value()deployment warning.Solution
ReferenceOptions.instancetostring | Expression<string>.getOpts().Testing
getOpts()preserving anExpression<string>.instancevalues.