Tag: firebase

名为“”的Firebase应用已经存在,并且Google的Firebase参考在服务器上不起作用

我遵循https://firebase.google.com/docs/database/server/retrieve-data#section-start中服务器configuration的所有步骤,但是当我尝试在浏览器中创build参考时告诉我应用程序称为[默认]已经存在。 那时如果preiono F5告诉我有“databaseUrl”,我必须确保在启动应用程序的firebase时提供这些数据。 var express = require('express'); var router = express.Router(); var firebase = require('firebase'); /* GET home page. */ router.get('/', function(req, res, next) { firebase.initializeApp({ serviceAccount: "aaaabbbbcccc.json", databaseUrl: "https://xxxxxyyyyyzzzzz.firebaseio.com/" // <<<<— it can not find }); var db = firebase.database(); // <<<<—- Here is a problem var ref = db.ref('vistas/principal'); ref.once('value', function(data){ res.render('index', { […]

从我之前部署的Firebase控制台获取代码

我已经在nodejs中创build了firebase函数,并将代码部署在firebase上。 该function是在创build新用户时发送电子邮件。 我现在已经丢失了代码。 我们可以从Firebase中获取代码吗?

如何使用云端函数删除文件?

当我在Firebase数据库中删除post时,我希望云function可以相应地删除post在Firebase存储中的缩略图。 我的问题是,当我试图删除缩略图我不认为我正确定位图像文件。 这是我所尝试的: const functions = require('firebase-functions') const admin = require('firebase-admin') const gcs = require('@google-cloud/storage')() exports.deletePost = functions.database.ref('Posts/{pushId}').onWrite(event => { const original = event.data.val() const previous = event.data.previous.val() const pushId = event.params.pushId if (original === null) return const filePath = 'Posts/' + pushId + 'thumbnail.jpg' const bucket = gcs.bucket('postsapp-12312') const file = bucket.file(filePath) const pr […]

无法在多个文件中拆分Firebasefunction

我正在使用firebase函数,并且到达了数百个函数,现在很难在单个index.js文件中进行pipe理,如大量示例中所示 我试图分割多个文件中的function,如: –firebase.json –functions –node_modules –index.js –package.json –app –groupFunctions.js –authFunctions.js –storageFunctions.js 在这个结构中,我将我的函数分为三类,并放入了三个文件groupFunctions.js , authFunctions.js和storageFunctions.js 。 然后我试图在index.js导入这个文件,但我不知道为什么它不适合我。 这里是groupFunctions.js var functions = require('firebase-functions'); module.exports = function(){ exports.onGroupCreate = functions.database.ref('/groups/{groupId}') .onWrite(event => { console.log(`A group is created in database named:${event.params.groupId}.`); // some logic… //… }) } 这里是index.js文件: var functions = require('firebase-functions'); module.exports = require("./app/groupFunctions")(); 我的编辑没有在这个代码中给出任何警告。 但是,当我部署这个代码与firebase deploy –only […]

admin.firestore不是在使用google云function和node.js时的function

这是node.js index.js文件的头文件: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); var db = admin.firestore(); 这是侦听firestore更改的node.js函数: exports.myFoo = functions.firestore .document('foo/{bar}') .onWrite(event => { // do stuff } 这是在package.json文件中: "dependencies": { "firebase-admin": "^5-.4.2", "firebase-functions": "^0.7.1", "firestore": "^1.1.6" }, 当我尝试做一个“firebase部署”命令这是我得到的错误: 错误:分析函数触发器时发生错误。 TypeError:admin.firestore不是一个函数 askFirebase

尝试连接到本地主机:5000 Firebase时获取“无法获取/”

我正在尝试让Firebase上的本地主机服务器正常工作,但我仍然在浏览器中无法获取以下消息。 我看了一下控制台,它所说的是“ http:// localhost: 5000/404(Not Found)”。 我试图重新运行服务器使用'firebase服务',并没有帮助。 我再次运行“firebase init”,这也没有帮助。 我通过运行'npm install -g firebase-tools'重新安装了firebase工具,然后再次运行firebase服务,但仍然没有任何结果。 不知道是怎么回事,因为它最初是在工作。 我安装了一些grunt插件,并将我的index.html文件移动到html文件夹下,尽pipe我仍然在公用文件夹下有一个index.html文件,但仍然显示'Can not GET /' 我也尝试在不同的浏览器重新启动它们等 我正在使用Mac OS X El Capitan。 让我知道如果你需要更多的信息。 提前致谢

进程超时| Amazon Lambda到Firebase

我在node.js中编写了代码,我的数据在Firebase上。 我面临的问题是,我的代码永远不会退出。 我已经做了这样一个链接 问题是,firebase参考/听众永远不会成为空,因此我的function永远不会退出。 我尝试使用firebase.database().goOffline()但它没有工作。 在我的本地机器上,我使用process.exit(0)强制停止进程,但是当我在AWS lambda上部署代码时,它不返回任何响应/callback并退出(给出错误消息“ 在完成请求之前退出进程 ” ) 在lambda中调用callback之后,我还添加了5-10秒的等待时间,然后强制退出了这个过程,但是也没有帮助。 如何解决这个问题? 请帮忙。

如何使用Firebase实施Steamvalidation?

我发现的只是这个旧的答案: https://groups.google.com/forum/#!topic/firebase-talk/rApG8QQd6t4 同事是否知道任何信息,或者Firebase工程师能否提供更详细的答案? 我目前正在尝试使用此库来validation用户使用Steam: https://github.com/liamcurry/passport-steam 然后使用Firebase自定义令牌在我的Firebase身份validation系统中获取用户。 我不知道这是否正确。 无论如何,我卡住了。 编辑: 这是我现在的代码: app.js var passport = require('passport'); var SteamStrategy = require('passport-steam').Strategy; app.use(passport.initialize()); passport.serializeUser(function(user, done) { done(null, user); }); passport.deserializeUser(function(obj, done) { done(null, obj); }); passport.use(new SteamStrategy({ returnURL: 'http://localhost:8080/users/steam/return', realm: 'http://localhost:8080/', apiKey: steamKey.steam, stateless:true }, function(identifier, profile, done) { profile.identifier = identifier; return done(null, profile); } )); users.js […]

如何使用新的Firebase(2016)实现无限滚动?

题: 如何使用JavaScript(和node.js)在Firebase中实现高效的无限滚动? 我检查了什么: 使用Firebase实现无限滚动? 问题:老火炉^ 无限滚动与AngularJs和Firebase 代码来自: AngularJs和Firebase的无限滚动 “首先,我build议在您的Firebase中创build一个索引,为此我创build了这个索引: { "rules": { ".read": true, ".write": false, "messages": { ".indexOn": "id" } } } 然后,让我们用Firebase制作一些魔法: // @fb: your Firebase. // @data: messages, users, products… the dataset you want to do something with. // @_start: min ID where you want to start fetching your data. // @_end: […]

如何使用私有NPM包与云function?

我正在尝试将应用切换到Firebase,并将后端传输到Firebase云端function。 此应用程序正在使用私有包( @org/name )作为依赖项。 我试过不同的解决scheme,但似乎没有工作: 传递一个NPM_TOKEN env:不可能,因为Firebase限制为小写configuration npm install模块npm install在函数目录中 使用YARN和NPM授权令牌在函数目录中创build一个.npmrc文件 它始终拒绝部署: Deploy Error: Build failed: Module @org/name not found in npm registry Firebase是否支持私人套餐?