gpt4 book ai didi

android - 功能部署错误 Firebase

转载 作者:太空狗 更新时间:2023-10-29 14:40:06 24 4
gpt4 key购买 nike

我尝试在 firebase 函数上发布简单代码,但每次都会产生错误

errors
functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (53.73 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating function sendNotification...
⚠ functions[sendNotification]: Deployment error.
Error setting up the execution environment for your function. Please
try again after a few minutes.


Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions

Error: Functions did not deploy properly.

我尝试部署的代码是

'use strict'

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




exports.sendNotification = functions.database.ref('/notifications/{user_id}/{notification_id}').onWrite(event => {




const user_id = event.params.user_id;
const notification_id = event.params.notification_id;

console.log('We have a notification from : ', user_id);

});

面对这个错误大约 2 天尝试堆栈和其他论坛上可用的所有答案,但能够找到任何人可以帮助我的解决方案

最佳答案

您应该让您的函数返回值、null 或 promise 。除此之外,我看不出有什么不妥。您似乎得到的错误可能是您这边的连接问题,或者(奇怪的是)Google 的 Firebase 方面的问题。

同时尝试更新您的 Firebase 工具

npm install -g firebase-tools

啊,考虑一下这里的更新以进行一些小的更改,因为云功能不再处于测试阶段: https://firebase.googleblog.com/2018/04/launching-cloud-functions-for-firebase-1-0.html?utm_source=email&utm_medium=email&utm_campaign=cloud_functions_v1.0

关于android - 功能部署错误 Firebase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49638427/

24 4 0
文章推荐: 找不到 Git 存储库
文章推荐: 安卓和 Kotlin : Unresolved reference: home
文章推荐: android BottomSheet 没有扩展到最大高度
文章推荐: html - 如何使按钮均匀拉伸(stretch)以填充容器
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com