我正在使用https://github.com/greenido/bitcoin-info-action
中的说明部署https://codelabs.developers.google.com/codelabs/your-first-action-on-google-with-webhook/#0当我使用示例中提供的Webhook URL时,它可以正常工作。当我自己使用代码为webhook构建和部署时,它不会生成函数URL。
以下是步骤:
我已经检查了左侧菜单上的firebase控制台和功能,但我没有找到URL,而是部署说明(与我使用的相同)
以下是firebase部署的输出:
[google-tester-mn1:~/soverflow/bitcoin-info-action-master ] $ /Users/google-tester/.nvm/versions/node/v9.3.0/lib/node_modules/firebase-tools/bin/firebase deploy
=== Deploying to 'bitcoininfo-5cb78'...
i deploying functions, hosting
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i hosting: preparing public directory for upload...
✔ hosting: 2 files uploaded successfully
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/bitcoininfo-5cb78/overview
Hosting URL: https://bitcoininfo-5cb78.firebaseapp.com
以下是deploy --only函数的输出:
Deploying to 'bitcoininfo-5cb78'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/bitcoininfo-5cb78/overview
目录的内容:
[google-tester-mn1:~/soverflow/bitcoin-info-action-master/functions ] $ ls -l ~/soverflow/bitcoin-info-action-master
total 96
-rwxr-xr-x@ 1 google-tester google-tester 1642 Nov 16 17:04 CONTRIBUTING.md
-rwxr-xr-x@ 1 google-tester google-tester 11325 Nov 16 17:04 LICENSE
-rwxr-xr-x@ 1 google-tester google-tester 3255 Nov 16 17:04 README.md
-rw-r--r--@ 1 google-tester google-tester 796 May 1 2017 agent.json
-rw-r--r--@ 1 google-tester google-tester 3865 Nov 16 17:04 bitcoin-info-io17.zip
-rw-r--r-- 1 google-tester google-tester 134 Dec 29 11:42 firebase.json
drwxr-xr-x 6 google-tester google-tester 204 Dec 29 12:31 functions
-rwxr-xr-x@ 1 google-tester google-tester 4411 Nov 16 17:04 index.js
drwxr-xr-x@ 7 google-tester google-tester 238 Dec 29 11:39 intents
-rwxr-xr-x@ 1 google-tester google-tester 647 Nov 16 17:04 package.json
drwxr-xr-x 4 google-tester google-tester 136 Dec 29 11:42 public
-rwxr-xr-x@ 1 google-tester google-tester 2476 Nov 16 17:04 webhook-example-bitcoin.php
Again:
[google-tester-mn1:~/soverflow/bitcoin-info-action-master/functions ]ls -l ~/soverflow/bitcoin-info-action-master/functions/
total 576
-rw-r--r--@ 1 google-tester google-tester 4411 Dec 29 12:23 index.js
drwxr-xr-x 124 google-tester google-tester 4216 Dec 29 12:24 node_modules
-rw-r--r-- 1 google-tester google-tester 281603 Dec 29 12:24 package-lock.json
-rw-r--r-- 1 google-tester google-tester 460 Dec 29 12:24 package.json
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": {
"actions-on-google": "^1.7.0",
"firebase-admin": "~5.4.2",
"firebase-functions": "^0.7.1"
},
"private": true
}
我拥有所有节点模块,包括google上的操作。关于缺少模块没有错误。
答案 0 :(得分:1)
问题在于代码是为Google Cloud Functions(GCF)编写的(正如Ido在他的评论中所说),而您正在尝试使用Cloud Functions for Firebase(CFF或GCFF)进行部署。虽然CFF建立在GCF之上,但在注册函数本身方面存在一些细微差别。
使用GCF,您需要:
gcloud
命令行工具或使用控制台)使用GCFF时,您需要:
firebase-functions
库(通常使用const functions = require('firebase-functions');
)functions.https.onRequest(...)
的结果firebase deploy
我已经提交了Ido的拉取请求来更改他的代码(https://github.com/greenido/bitcoin-info-action/pull/4),或者您可以在https://github.com/afirstenberg/bitcoin-info-action将其从主文件中删除。
答案 1 :(得分:0)
如果你去你的firebase控制台(使用你的网络浏览器),也会有履行网址。