Firestore-BigQuery导出扩展请求超限致数据同步缺失求助
问题:Firestore批量导入数据后BigQuery同步缺失
现象
安装Firestore转BigQuery的Firebase扩展,每月批量向Firestore集合导入数据,本月导入2706条,但仅2646条同步至BigQuery,缺失60条。
报错信息
Error: Exceeded rate limits: too many api requests per user per method for this user_method.Error: Process exited with code 16 at process.
已尝试的支持沟通
联系Firebase支持,对方建议升级最新版firebase-admin和firebase-functions包,但存在破坏性变更,升级时出现错误,后续未获得更多帮助,且多个集合均出现该问题。
考虑的解决方案选项
- 升级至最新firebase-admin和firebase-functions包并修改代码适配破坏性变更,但不确定是否有效。
- 将Firebase扩展从0.1.24升级至0.1.29(该版本新增“Use new query syntax for snapshots”开关,相关信息较少),但升级后问题仍存在,报错相同。
- 提升BigQuery配额。
- 降低Firestore数据导入速度,改为按日/周导入而非按月。
当前Node.js环境依赖版本
- firebase-admin: 9.12.0
- firebase-functions: 3.24.1
- firebase/firestore-bigquery-export@0.1.24
导入代码示例
const platformFeesCollectionPath = `platformFees`; const limit = 500; let batch = db.batch(); let totalFeeCount = 0; let counter = 0; for (const af of applicationFees) { const docRef = db.collection(platformFeesCollectionPath).doc(); batch.set(docRef, { ...af, dateCreated: getTimestamp(), dateModified: getTimestamp() }) counter++; if (counter === limit || counter === applicationFees.length) { await batch.commit(); console.log(`Platform fees batch run for ${counter} platform fees`); batch = db.batch(); totalFeeCount = totalFeeCount + counter; counter = 0; } } if (applicationFees.length > limit) { // Need this commit if there are multiple batches as the applicationFees.length does not work await batch.commit(); totalFeeCount = totalFeeCount + counter; } if (counter > 0) { console.log(`Platform fees batch run for ${totalFeeCount} platform fees`); }
排查更新
- 通过GCP日志查询语句
protoPayload.status.code ="7" protoPayload.status.message: ("Quota exceeded" OR "limit")发现大量配额超限错误。 - 已在对应仓库提交issue。
内容的提问来源于stack exchange,提问作者MadMac
相关产品推荐
相关产品推荐

