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
{{ message }}
Repository navigation
[Data Connect] getDataConnect() ignores connector field in cache key #3054
Yes, this is a bug in the firebase-admin/data-connect module code.
[REQUIRED] Step 2: Describe your environment
Operating System version: macOS / Linux
Firebase SDK version: firebase-admin@13.x (all versions with Data Connect support)
Firebase Product: Data Connect
Node.js version: 24.x
NPM version: 11.x
[REQUIRED] Step 3: Describe the problem
Summary
The DataConnectService.getDataConnect() method caches DataConnect instances using only location and serviceId as the cache key, ignoring the connector field from ConnectorConfig.
This causes incorrect behavior when using multiple connectors with the same Data Connect service.
Steps to reproduce:
Create a Data Connect service with multiple connectors (e.g., public, user, admin)
Call getDataConnect() with different connector configs that share the same location and serviceId
Observe that both calls return the same DataConnect instance
Expected behavior:
Each unique combination of location, serviceId, and connector should return a distinct DataConnect instance.
Actual behavior:
The second call returns the cached instance from the first call, ignoring the different connector value.
Relevant Code:
import{getDataConnect,ConnectorConfig}from'firebase-admin/data-connect';constpublicConfig: ConnectorConfig={location: 'us-west2',serviceId: 'my-service',connector: 'public',};constuserConfig: ConnectorConfig={location: 'us-west2',serviceId: 'my-service',connector: 'user',// Different connector!};constpublicDc=getDataConnect(publicConfig);constuserDc=getDataConnect(userConfig);console.log(publicDc===userDc);// true (BUG! Should be false)console.log(userDc.connectorConfig.connector);// 'public' (BUG! Should be 'user')
Impact:
When using multiple connectors (a common pattern for role-based access control), operations intended for one connector are incorrectly routed to another, causing "operation not found" errors.
*itok01* created an issue (firebase/firebase-admin-node#3054)
<#3054>
[READ] Step 1: Are you in the right place?
Yes, this is a bug in the firebase-admin/data-connect module code.
[REQUIRED] Step 2: Describe your environment
- Operating System version: macOS / Linux
- Firebase SDK version: ***@***.*** (all versions with Data
Connect support)
- Firebase Product: Data Connect
- Node.js version: 24.x
- NPM version: 11.x
[REQUIRED] Step 3: Describe the problem Summary
The DataConnectService.getDataConnect() method caches DataConnect
instances using only location and serviceId as the cache key, ignoring
the connector field from ConnectorConfig.
This causes incorrect behavior when using multiple connectors with the
same Data Connect service.
Steps to reproduce:
1. Create a Data Connect service with multiple connectors (e.g., public,
user, admin)
2. Call getDataConnect() with different connector configs that share
the same location and serviceId
3. Observe that both calls return the same DataConnect instance
Expected behavior:
Each unique combination of location, serviceId, and connector should
return a distinct DataConnect instance.
Actual behavior:
The second call returns the cached instance from the first call, ignoring
the different connector value.
Relevant Code:
import { getDataConnect, ConnectorConfig } from 'firebase-admin/data-connect';
const publicConfig: ConnectorConfig = {
location: 'us-west2',
serviceId: 'my-service',
connector: 'public',};
const userConfig: ConnectorConfig = {
location: 'us-west2',
serviceId: 'my-service',
connector: 'user', // Different connector!};
const publicDc = getDataConnect(publicConfig);const userDc = getDataConnect(userConfig);
console.log(publicDc === userDc); // true (BUG! Should be false)console.log(userDc.connectorConfig.connector); // 'public' (BUG! Should be 'user')
Impact:
When using multiple connectors (a common pattern for role-based access
control), operations intended for one connector are incorrectly routed to
another, causing "operation not found" errors.
Root cause:
In src/data-connect/data-connect.ts, line 39:
const id = `${connectorConfig.location}-${connectorConfig.serviceId}`;
The cache key should also include the connector field:
const id = `${connectorConfig.location}-${connectorConfig.serviceId}-${connectorConfig.connector ?? ''}`;
I have a fix ready with tests and would like to submit a PR.
—
Reply to this email directly, view it on GitHub
<#3054>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/B4DLRRDFV6T3DVNALT2DF7L4GJRDLAVCNFSM6AAAAACRKZOSYKVHI2DSMVQWIX3LMV43ASLTON2WKOZTHAYDCNBQHE4TQNI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Activity
enriquealejandroduranrivas3-hub commentedon Jan 11, 2026
stephenarosaj commentedon Jan 12, 2026
@itok01 thank you for reporting this, and thank you for the PR! We'll respond here and/or on your PR when we have any updates :)