我开发了一个应用程序,并将其部署在Heroku上。后端进程应每小时运行一次,并在Firebase数据库中推送一些数据。为此,我遵循Firebase Admin SDK指南来授予对服务器的访问权限。(https://firebase.google.com/docs/database/admin/start)
本地一切正常,但当我打开Heroku上的应用程序,我得到了"应用程序错误"。
查看应用程序日志似乎问题出在模块的serviceAccountKey上。json’,存储在节点_模块中。
我已经读过这篇文章,serviceAccountKey在哪里或是什么。json是firebase实时数据库的node js示例,在我看来,我做的一切都很好,但我确信我遗漏了一些东西。。。但是什么呢?
有人能帮我弄清楚吗?
Firebase指令
var admin = require("firebase-admin");
var serviceAccount = require("path/to/serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://sunset-3a5bb.firebaseio.com"
});
我的代码
var admin = require('firebase-admin');
var serviceAccount = require("serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://sunset-3a5bb.firebaseio.com"
});
Heroku应用日志
2020-05-27T18:10:20.716666+00:00 app[scheduler.8534]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2020-05-27T18:10:20.716666+00:00 app[scheduler.8534]: at Module.load (internal/modules/cjs/loader.js:986:32)
2020-05-27T18:10:20.716666+00:00 app[scheduler.8534]: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2020-05-27T18:10:20.716667+00:00 app[scheduler.8534]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
2020-05-27T18:10:20.716667+00:00 app[scheduler.8534]: code: 'MODULE_NOT_FOUND',
2020-05-27T18:10:20.716668+00:00 app[scheduler.8534]: requireStack: [ '/app/server.js' ]
2020-05-27T18:10:20.716668+00:00 app[scheduler.8534]: }
2020-05-27T18:10:20.778079+00:00 heroku[scheduler.8534]: Process exited with status 1
2020-05-27T18:10:20.824064+00:00 heroku[scheduler.8534]: State changed from up to complete
2020-05-27T18:10:55.972034+00:00 heroku[web.1]: State changed from crashed to starting
2020-05-27T18:11:01.422903+00:00 heroku[web.1]: Starting process with command `npm start`
2020-05-27T18:11:05.047578+00:00 app[web.1]:
2020-05-27T18:11:05.047603+00:00 app[web.1]: > sunset-website@1.0.0 start /app
2020-05-27T18:11:05.047603+00:00 app[web.1]: > node server.js
2020-05-27T18:11:05.047604+00:00 app[web.1]:
2020-05-27T18:11:06.071677+00:00 app[web.1]: 23363
2020-05-27T18:11:06.851354+00:00 app[web.1]: internal/modules/cjs/loader.js:969
2020-05-27T18:11:06.851370+00:00 app[web.1]: throw err;
2020-05-27T18:11:06.851371+00:00 app[web.1]: ^
2020-05-27T18:11:06.851371+00:00 app[web.1]:
2020-05-27T18:11:06.851372+00:00 app[web.1]: Error: Cannot find module 'sunset-3a5bb-firebase-adminsdk-888zm-9dd45c565b.json'
2020-05-27T18:11:06.851372+00:00 app[web.1]: Require stack:
2020-05-27T18:11:06.851373+00:00 app[web.1]: - /app/server.js
2020-05-27T18:11:06.851374+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
2020-05-27T18:11:06.851374+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:842:27)
2020-05-27T18:11:06.851375+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1026:19)
2020-05-27T18:11:06.851375+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-05-27T18:11:06.851376+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:32:22)
2020-05-27T18:11:06.851376+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1138:30)
2020-05-27T18:11:06.851376+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2020-05-27T18:11:06.851377+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:986:32)
2020-05-27T18:11:06.851377+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2020-05-27T18:11:06.851378+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
2020-05-27T18:11:06.851378+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-05-27T18:11:06.851378+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2020-05-27T18:11:06.851379+00:00 app[web.1]: }
2020-05-27T18:11:06.859304+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-05-27T18:11:06.859606+00:00 app[web.1]: npm ERR! errno 1
2020-05-27T18:11:06.860754+00:00 app[web.1]: npm ERR! sunset-website@1.0.0 start: `node server.js`
2020-05-27T18:11:06.860884+00:00 app[web.1]: npm ERR! Exit status 1
2020-05-27T18:11:06.861074+00:00 app[web.1]: npm ERR!
2020-05-27T18:11:06.861207+00:00 app[web.1]: npm ERR! Failed at the sunset-website@1.0.0 start script.
2020-05-27T18:11:06.861336+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-27T18:11:06.873419+00:00 app[web.1]:
2020-05-27T18:11:06.873580+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-05-27T18:11:06.873754+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-05-27T18_11_06_863Z-debug.log
2020-05-27T18:11:06.948847+00:00 heroku[web.1]: Process exited with status 1
2020-05-27T18:11:06.985499+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-27T18:23:38.792488+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=london-sunset.herokuapp.com request_id=bf2bafdc-d5b0-4b1f-a9c8-7b7bfa203cc1 fwd="176.251.241.40" dyno= connect= service= status=503 bytes= protocol=https
2020-05-27T18:23:39.388980+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=london-sunset.herokuapp.com request_id=0b301253-1fee-456c-af19-10ef8fb122c3 fwd="176.251.241.40" dyno= connect= service= status=503 bytes= protocol=https
谢谢
打开package.json文件并检查Firebase是否作为依赖项添加。如果没有,请安装并重新部署到Heroku。
救命.....
我的管理员控制器扩展了控制器类,在那里我使用方法加载视图页面并传递保护。config/auth.php也通过添加管理员保护和提供程序进行了修改。在app/Actions/Fortify文件夹中,我添加了AttemptToAuthenticate和ReDirectIfTwoFactorAuthenticate类,并更改了命名空间。我的管理员控制器还扩展了Guard。用户的重定向中间件和管理员的重定向
我一直很难找到Google Firebase身份验证背后的SLA。根据托管和实时数据库的服务水平协议,Firebase的每月正常运行时间百分比应至少达到99.95%。它是否适用于身份验证服务?
假设我需要通过Firebase电话身份验证来验证用户。但不知何故,用户没有得到otp短信。那么firebase是否提供了通过接收呼叫获取OTP的选项?
问题内容: 我的Node应用程序在本地运行良好,但是在部署到Heroku时遇到错误。该应用程序使用Sequelize在一个文件夹,其中包含,和。在本地,我可以使用中的以下代码导入模型: 这很好,但是,当我部署到Heroku时,应用程序崩溃并显示以下错误: 最初我以为是由于区分大小写(本地mac与heroku linux),但是我移动了文件,进行了git commit,然后又移回并再次提交,以确保在
我目前正在使用FirebaseAuth和web小部件库firebaseui web开发基于VueJS的登录流原型。 成功认证后(无论是< code>password还是< code>google provider ),小部件加载栏会不断重复,firebaseui-web不会触发其< code > signinseccesswithauthresult 回调。但是对< code > identity