Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

serverTimestamp fails when uploading to firestore.

オープン
#3,509 コメント 6 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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
平均マージ
3日 6時間
マージ済み PR(30日)
5

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angularfire のほかの issue

angular/angularfire の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。