serverTimestamp fails when uploading to firestore.
維護者通常 2 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- angular, typescript
研究方向
首先,使用列出的 Angular、Firebase、AngularFire 和 Node 版本重現提供的 AngularFirestore batch.update() 範例。將 serverTimestamp 和相關欄位值的 compat 用法與目前的文件進行比較;當重現過程獲得說明,且支援的用法或所需文件明確時,即視為完成。
由索引模型根據 Issue 內容生成。
描述
Version info
Angular: ^17.3.0",
Firebase: 9.23.0
AngularFire: ^17.0.1",
Node v20.11.
How to reproduce these conditions
Failing test unit, Stackblitz demonstrating the problem:
Currently, I do not have a failing test unit or a Stackblitz example, but I can describe the issue and the steps to reproduce it below.
Steps to set up and reproduce:
Set up AngularFirestore and AngularFireStorage in your Angular component.
Create a form with a field set to serverTimestamp().
Attempt to update a Firestore document using WriteBatch.update() with the form values.
Here is a snippet of the code causing the issue:
import { serverTimestamp } from 'firebase/firestore';
import { AngularFirestore } from '@angular/fire/compat/firestore';
constructor(private afs: AngularFirestore, ...) {
this.form = this.builder.group({
dateReported: [serverTimestamp(), Validators.required],
...
});
const batch = this.afs.firestore.batch();
const orderRef = this.afs.firestore.collection(...).doc(....);
batch.update(orderRef, this.form.value);
batch.commit()
}
Sample data and security rules:
Please provide the necessary data structure and Firestore security rules if they are relevant to the issue.
Debug output
Errors in the JavaScript console:
{
"items": [
{
"sku": "2756",
"qty": 1,
"name": "\tImpresora Artillery X3 Plus"
}
],
"dateReported": {
"_methodName": "serverTimestamp"
},
"dateModified": {
"_methodName": "serverTimestamp"
},
"trialsAndResults": "cable suelto",
"inspectedItems": [
{
"sku": "2756",
"qty": 1,
"name": "\tImpresora Artillery X3 Plus",
"dictum": "repair"
}
],
"status": "examined",
"technician": "Cristobal",
"charge": 0,
"report": null
}
FirebaseError: Function WriteBatch.update() called with invalid data. Unsupported field value: a custom sl object (found in field dateReported in document [...])
Output from firebase.database().enableLogging(true);:
Please attach output if available.
Screenshots:
Please attach screenshots if they help illustrate the problem.
Expected behavior
The expected behavior is that the Firestore document should be updated with the current server timestamp in the dateReported field without any errors.
Actual behavior
The actual behavior is that an error is thrown when trying to update the Firestore document, indicating that an unsupported field value (a custom sl object) was found in the dateReported field.
Also there is no documentation how to use serverTimestamp, increment, etc, for current version using compat.
- 主要語言
- TypeScript
- 星號
- 7.8k
- 分支
- 2.2k
- 平均合併
- 2 天 17 小時
- 30 天內合併 PR
- 11
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
angular/angularfire 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
angular/angularfire#3774 ·
維護者通常 2 天內回覆
-
Use `TransferState` to hand server-rendered Firestore data to the browser, instead of reading every document twice可能重新可做 @armando-navarro 於 28 天前認領,目前沒有進行中的 PR。 未關閉comp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
Six `firebase` entry points have no `@angular/fire` equivalent, so their exports are unreachable可能重新可做 @armando-navarro 於 28 天前認領,目前沒有進行中的 PR。 未關閉comp: core type: feature
angular/angularfire#3755 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
難度 4/5 3-5 天 新手友好度 35/100
angular/angularfire#3737 · 2 則留言 · 22 個 reaction ·
維護者通常 2 天內回覆
-
難度 4/5 3-5 天 新手友好度 52/100
angular/angularfire#3715 ·
維護者通常 2 天內回覆
查看 angular/angularfire 的全部 Issue
相似的 Issue
-
triage
難度 1/5 1 小時以內 新手友好度 90/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
mermaid-js/mermaid-live-editor#2053 ·
維護者通常 1 天內回覆
-
factory
難度 2/5 1-3 小時 新手友好度 82/100
jessepollak/home#1455 ·
維護者通常 1 天內回覆
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難度 1/5 1 小時以內 新手友好度 95/100
lingdojo/kana-dojo#31227 · 1 則留言 · 5 個 reaction ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 92/100
appandflow/stim#1838 ·
維護者通常 1 天內回覆