本頁列出您可能會遇到的錯誤代碼,並提供每項錯誤的修正建議。
DeadlineExceeded (262)
下列情況可能會增加 DeadlineExceeded (262) 錯誤:
- 延遲時間增加,導致作業時間超過期限 (預設為 60 秒)。
DeadlineExceeded (262): Deadline exceeded.
如要解決這個問題,請參閱延遲時間疑難排解指南。
已取消 (112)
下列情況可能會增加 Aborted (112) 錯誤:
- 文件每秒收到的更新過多。
- 重疊交易造成的爭用。
- 流量快速增加或遇到熱點。
Aborted (112): Too much contention on these documents. Please try again
或
Aborted (112): Aborted due to cross-transaction contention. This occurs when
multiple transactions attempt to access the same data, requiring at least one
to be aborted in order to enforce serializability.
如何解決這個問題:
- 如果流量快速增加,Cloud Firestore 會嘗試自動調度資源,以因應增加的需求。Cloud Firestore 擴充後,延遲時間就會開始縮短。
- 熱點會限制 Cloud Firestore 的擴充能力。請參閱設計擴充功能,找出熱點。
- 查看交易中的資料爭用和交易使用情形。
- 降低個別文件的寫入速率。
InvalidArgument (2)
下列情況可能會導致 InvalidArgument (2) 錯誤:
- 嘗試提交的文件超過索引項目的 7.5 KiB 限制。
7.5 KiB 是索引項目的限制。您無法超過這項限制,也無法調整這項配額。
InvalidArgument (2): Index entry on field_name is larger than 7680 bytes.
如何解決這個問題:
如果是已建立索引的欄位值,請將欄位分割為多個欄位。如果可以,請建立未建立索引的欄位,並將不需要建立索引的資料移至未建立索引的欄位。