[Data Connect] getDataConnect() ignores connector field in cache key
@stephenarosaj 已经在做这个了。
开始于 2026年1月12日。
评估
这个 Issue 还没有评估数据。
描述
[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: 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 samelocationandserviceId - Observe that both calls return the same
DataConnectinstance
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: #3055
- 主要语言
- TypeScript
- 星标
- 1.7k
- 派生
- 419
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 16
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-admin-node 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 条评论 · 已指派 1 人 ·
-
api: messaging
难度 3/5 1-2 天 新手友好度 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
难度 5/5 一周以上 新手友好度 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 条评论 · 已指派 1 人 ·
查看 firebase/firebase-admin-node 的全部 Issue
相似的 Issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
Crush 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
catppuccin/catppuccin#3125 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
ElementsProject/cln-application#167 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Quantco/pnpm-licenses#17 ·
-
难度 2/5 1-3 小时 新手友好度 75/100