0

I am deploying https://github.com/greenido/bitcoin-info-action with instructions from https://codelabs.developers.google.com/codelabs/your-first-action-on-google-with-webhook/#0

When I use the Webhook URL provided in the example, it works fine. When I build and deploy using the code myself for the webhook , it does not generate function URL.

Here are the steps:

  1. Clone the Git Repo https://github.com/greenido/bitcoin-info-action
  2. Do a firebase init Do a firebase deploy (install all modules as needed)
  3. I have not changed the index.js , reviewed the answers at Can't find the function url for Firebase webhook in Google Assistant tutorial and others.

I have checked the firebase console and functions on the left menu and I do not find a URL, instead instructions on deploy (same that I used )

Here is the output of firebase deploy:

[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

Here is the output of deploy --only functions:

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

Contents of the directory:

[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

Contents of 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 }

I have all the node modules, including actions-on-google. There is no error about missing modules.

2 Answers2

1

The problem is that the code was written for Google Cloud Functions (GCF) (as Ido notes in his comment), while you're trying to deploy it with Cloud Functions for Firebase (CFF or GCFF). While CFF is built on top of GCF, there are some slight differences in how you register the function itself.

With GCF you need to:

  1. Export the function
  2. Upload the code to GCF (either using the gcloud command line tool or using the console)
  3. If you used the console, add the function

While with GCFF you need to:

  1. Require the firebase-functions library in your code (usually with something like const functions = require('firebase-functions');)
  2. Export the results of functions.https.onRequest(...) in your code
  3. Deploy with firebase deploy

I've submitted a pull request for Ido to change his code (https://github.com/greenido/bitcoin-info-action/pull/4) or you can just pull it from master at https://github.com/afirstenberg/bitcoin-info-action.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
0

If you go to your firebase console (with your web browser), the fulfillment URL is there too.

gla_mp4
  • 21
  • 5