FB firestore cloud-Funktionen zeigt Fehler: Ungültiger Typ "undefined" als argument Firestore

Habe ich ein Projekt hinzufügen, Währung details in der firestore-Datenbank und mein Projekt wird dabei mit ionic 3

Immer wenn ich ein neues Dokument hinzufügen, um die Sammlung eine trigger-Funktion onCreate() ausgeführt wird, und aktualisieren Sie das Dokument mit dem Namen 'aktualisiert'.

Aber die trigger-Funktion zeigt immer einen Fehler an.

Error: Invalid use of type "undefined" as a Firestore argument.
    at Object.exports.customObjectError.val [as customObjectError] (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/validate.js:164:14)
    at Function.encodeValue (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/document.js:808:20)
    at Function.encodeFields (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/document.js:678:36)
    at Function.fromObject (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/document.js:218:55)
    at WriteBatch.set (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/write-batch.js:291:39)
    at DocumentReference.set (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/reference.js:419:8)
    at Object.<anonymous> (/user_code/lib/index.js:28:10)
    at next (native)
    at /user_code/lib/index.js:7:71
    at __awaiter (/user_code/lib/index.js:3:12)

sombody bitte helfen..

verbrachte ich viel Zeit auf Sie.

Hier ist der code :

import * as functions from 'firebase-functions';

const admin = require('firebase-admin');
admin.initializeApp();

exports.createCurrency = functions.firestore
.document('Exchange/{ExchangeId}')
.onCreate( async (snap, context) => {

const id: string = snap.data().id;
const branchName: string = snap.data().branchName;
const currencyName: string = snap.data().currencyName;
const buyingRate : string = snap.data().buyingRate;
const sellingRate : string = snap.data().sellingRate;


 const newUser= admin.
 firestore()
 .doc(`Exchange/updated`)
 .set({
   id : id,
   branchName : branchName,
   currencyName : currencyName,
   sellingRate : sellingRate,
   buyingRate :buyingRate
  });

 return newUser;


 });
InformationsquelleAutor pepe | 2018-05-01
Schreibe einen Kommentar