我已經在我的Mac上安裝了Firebase工具。 的火力版本我只有3.14.0部署到Firebase雲功能時出錯 - ?缺少配置詳細信息
我覺得看完這個: https://firebase.google.com/docs/functions/config-env
所有我需要做的是運行:
firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID"
但是,如果我錯了有下面是解釋我的問題的長篇文章。
謝謝。
使用指南::
https://firebase.google.com/docs/functions/get-started
我的目錄結構看起來很漂亮的聲音。 該文件的package.json低於:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"shell": "firebase experimental:functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~5.4.2",
"firebase-functions": "^0.7.1"
},
"private": true
}
在index.js文件我已經得到了三行代碼:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
但是當我運行火力部署停止在準備功能上傳。
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
/private/var/folders/1v/xxxxxxxxxxxxxxxxxxxxxxxx/T/xxxxxxxxxxxxxxxxxx/index.js:2
const admin = require('firebase-admin’);
^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
我用火力點雲功能之前,與以前的應用程序,我有點幫助安裝的最初和我記得有可能做出一些改動與火力功能的配置文件。但我真的不記得。這次唯一的區別是安裝Firebase工具時我選擇了Firestore以及Firebase數據庫。
我也檢查過我是用firebase登錄登錄的,我是。
更新:
我也看看:
https://firebase.google.com/docs/functions/config-env
我只是不知道我需要設置哪些環境變量。
還有就是是後Cloud Functions for Firebase Error occurred while parsing your function triggers
關於設置:
firebase functions:config:set gmail.email="[email protected]" gmail.password="gmailPassword"
但我登錄已經與我的電子郵件所以不知道是否需要重新設置。
還有https://firebase.google.com/docs/admin/setup和幾行關於「如果您在Cloud Function中使用Node.js Admin SDK,則可以通過functions.config()變量自動初始化SDK:」admin.initializeApp(functions的.config()。火力);
有這個帖子也重新:手動設置一個配置文件,但wan't確定它是如何相關:
How do you setup local environment variables for Cloud Functions for Firebase
感謝。
THX!我正在閱讀文檔,所以我認爲我只是將他們的代碼版本複製到了stackoverflow中,並且我懷疑我所做的是我必須意外刪除了',同時嘗試理清index.js文件,而用撇號替換它。 – Mike