10

I've been doing the Codelabs tutorial on "Facts about You: Build a conversational app for the Google Assistant" but have run into a problem.

Page 4 of the tutorial is devoted to using Cloud Functions for Firebase for setting up a webhook to provide custom responses. Step 7 on that page says "Once the Cloud Functions is deployed, the Function URL will be printed in the Firebase CLI logs. This URL is separate from the Project Console URL.”

My problem is that I only see the Console URL. I don’t see a Function URL anywhere.

Can anyone please clarify where I should find the Function URL? My app won’t run properly without knowing the endpoint URL for the webhoook.

Thanks!

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Mark
  • 103
  • 1
  • 1
  • 7

6 Answers6

13

I noticed you included the tag #actions-on-google in your question. I think perhaps Firebase does not print the URL for dialogflowFirebaseFulfillment actions. But, you can also view your functions' URLs inside the Firebase console.

If you don't know it already, you can get the console's URL from deploying. After deploying the console URL will be printed in the output as shown below. Note console URL does not change from deploy to deploy, so you can bookmark it as well.

Project Console: https://console.firebase.google.com/project/goodmorningroutine-ac4b1/overview

Inside the Firebase console go to Functions on the left. That page will show a list of functions each with its request URL as shown below.

enter image description here

studgeek
  • 14,272
  • 6
  • 84
  • 96
6

When the codelab instructs you to run firebase deploy --only functions, it will output the URL for the HTTP function that you created. It will be the last line of output and look something like this:

Function URL (foo): https://us-central1-my-codelab.cloudfunctions.net/foo

Copy that URL - it's your webhook endpoint.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • 4
    But where will it output it? It's not showing up in terminal. Al I get is this: ` === Deploying to 'myprojectname-1234'... i deploying functions i functions: ensuring necessary APIs are enabled... i runtimeconfig: ensuring necessary APIs are enabled... ✔ runtimeconfig: all necessary APIs are enabled ✔ functions: all necessary APIs are enabled i functions: preparing functions directory for uploading... i starting release process (may take several minutes)... ✔ Deploy complete! Project Console: https://console.firebase.google.com/project/myprojectname-1234/overview` – Mark Sep 06 '17 at 21:53
  • 1
    Then you probably don't have an HTTP function defined in your index.js. – Doug Stevenson Sep 06 '17 at 22:00
  • That's true, but there was nothing in the tutorial explaining the need to create one. Instead, it provided a zip file to upload, one that contains all the needed files. And following the steps of the tutorial results in a non-working app. – Mark Sep 06 '17 at 22:04
  • But I've just downloaded the files from GitHub again, and can see that the code is there. Something got nuked at some point by me, but it's not clear how. Thanks for pointing me in the right direction. Much appreciated. – Mark Sep 06 '17 at 22:10
2

I was facing the same issue ..... I Just saved the file before deploying

That easy I hope it works for you

1

I ran into the same problem.

It works when I deploy the file from here.

After comparing with my own file, I realized that missed two lines in failed case:

const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
陳得妮
  • 11
  • 1
0

As per the google Firebase docs you need to make sure that you are writing your functions in the index.js file in the functions directory. If you run firebase deploy --only functions the CLI will look at that specific index folder. If there are no functions specified in the index.js file in the functions directory you will just see "Deploy Complete" and the URL of the Console

MangoHeat
  • 1
  • 3
0

Save the index.js file and then run "Firebase deploy --only functions" again. That worked for me so hopefully will work on your side as well.

DevSpace
  • 105
  • 1
  • 10