アプリでユーザーを認証した後、firestoreのuserProfileコレクションにユーザープロファイルドキュメントを作成するクラウド機能を作成します。firestoreでクラウド機能を使用してドキュメントを作成する
これは私がUSERPROFILEと呼ばれるコレクションを持っているfirestoreクラウドデータベースで
TypeError: admin.firestore(...).ref is not a function
at exports.createProfile.functions.auth.user.onCreate.event (/user_code/index.js:13:30)
at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:59:27)
at next (native)
at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71
at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12)
at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:53:36)
at /var/tmp/worker/worker.js:695:26
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
をエラー受け付けておりますされ、クラウド機能ここで
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
//function that triggers on user creation
//this function will create a user profile in firestore database
exports.createProfile = functions.auth.user().onCreate(event => {
// Do something after a new user account is created
return admin.firestore().ref(`/userProfile/${event.data.uid}`).set({
email: event.data.email
});
});
のための私の全体のindex.jsファイルです
よく見えます。 –
私はこのエラーを取得しようとしますadmin.firestore()。refは関数ではありません –
ファイル全体とエラー全体を表示できますか? –