更新后的Firebase-Functions错误?我能做些什么? [英] Firebase-Functions error after update? what can i do?

查看:74
本文介绍了更新后的Firebase-Functions错误?我能做些什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新了我的firebase函数,现在我在firebase控制台中收到此错误...代码仍然相同,但现在却出现了错误:(

i updated my firebase-functions and now i get this error in the firebase console... the code is still the same but i got an error now :(

/srv/node_modules/@google-cloud/firestore/build/src/collection-group.js:54
    async *getPartitions(desiredPartitionCount) {
          ^

SyntaxError: Unexpected token *
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/srv/node_modules/@google-cloud/firestore/build/src/index.js:39:28) 

这是我的云函数打字稿来源:

this is my cloud function typescript source:

import * as functions from 'firebase-functions';
import admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

/********************************************************************/

exports.newChatMessage = functions.firestore
  .document('/games/{gameId}/chat/{chatId}')
  .onCreate((snap, context) => { 

    const createData = snap.data();
    if(!createData){
        return false;
    }

    const chatMessage = createData.message;
    if(!chatMessage){
        return false;
    }

    console.log('New Chat message in game: ', context.params.gameId);

    const payload = {
        notification: {
            title: 'New chat message',
            body: chatMessage,
            icon: 'ic_notification'
        }
    }

    return admin.firestore().collection(`/games/${context.params.gameId}/members`).where( 'notificationChat', '==', true ).get().then( members => {
        members.forEach( member => {
            if(member.id !== createData.user){
                return admin.firestore().doc(`/users/${member.id}`).get().then( memberdata => {
                    if( memberdata.get('firebaseToken') === '' ){
                        return memberdata.data();
                    } else {
                        return admin.messaging().sendToDevice(memberdata.get('firebaseToken'), payload).catch( error => { console.log(error) });
                    }
                }).catch( error => { console.log(error) });
            } else {
                return false;
            }
        })
    }).catch( error => { console.log(error) });

   });

有人知道这是什么吗?在我的函数中,没有名为* getPartitions

anyone has an idea what this is? in my functions there is no method that is named *getPartitions

推荐答案

谢谢,Marcel Hoekstra,降级后:将firebase-admin和firebase-functions降级为版本:"firebase-admin":"^ 8.10.0"; ,"firebase-functions":"^ 3.6.1";而且有效.

Thanks, Marcel Hoekstra, After downgrade: firebase-admin and firebase-functions to a version : "firebase-admin": "^8.10.0", "firebase-functions": "^3.6.1" and it worked.

非常感谢.

这篇关于更新后的Firebase-Functions错误?我能做些什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆