小编Bas*_*Bas的帖子

云功能中的云消息传递:admin.messagin(...).send不是一个功能

我的功能由数据库事件触发,并使用Firebase Cloud Messaging向主题发送通知.我的第一个函数工作正常,但第二个函数不断抛出此错误:

2018-02-20T21:16:49.878Z E receiveMessage: TypeError: admin.messaging(...).send is not a function
at exports.receiveMessage.functions.database.ref.onCreate (/user_code/index.js:55:27)
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)
Run Code Online (Sandbox Code Playgroud)

这是index.js文件:

const functions = require('firebase-functions');

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

// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
//  response.send("Hello from Firebase!");
// });
exports.recceiveInvitation = /* the function that works */;

exports.receiveMessage = …
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-functions firebase-cloud-messaging firebase-admin

5
推荐指数
1
解决办法
3857
查看次数

未调用 Firebase signInSuccessWithAuthResult

我正在为我的网站使用 Firebase 身份验证,但遇到了问题。我想避免登录后自动重定向,据我所知,如果您在回调中返回 false,则不会重定向。我的问题是没有调用signInSuccessWithAuthResult回调。为什么不调用它,有没有更好的方法来实现这一目标?

window.addEventListener('load', function () {
 var uiConfig = {
    callbacks: {
        signInSuccessWithAuthResult: function(authResult, redirectUrl) {
          // User successfully signed in.
          console.log("sign in success");
          // don't redirect automatically
          return false;
        }
    },
    signInSuccessUrl: <I dont want to go here>,
    signInOptions: [
      // Leave the lines as is for the providers you want to offer your users.
      firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      firebase.auth.EmailAuthProvider.PROVIDER_ID
    ],
    // Terms of service url.
    tosUrl: '<your-tos-url>',
    // Privacy policy url.
    privacyPolicyUrl: '<your-privacy-policy-url>'
};

firebase.auth().onAuthStateChanged(function (user) { …
Run Code Online (Sandbox Code Playgroud)

javascript firebase firebase-authentication

5
推荐指数
1
解决办法
3045
查看次数