0

Screenshot attached when I entered "Firebase deploy" command

I was trying to execute this set on instructions while deploying webhook using Google Cloud Functions for Firebase and the static resources needed by the project using Firebase Hosting:

Run firebase init, and select to configure Hosting and Functions. Select the project. In the configuration wizard, accept all the default choices.

Generate a private key using Firebase Settings/Service Accounts, and edit functions/database.js with the path to the JSON cert file. Now populate the database: node database.js

Run firebase deploy and take note of the endpoint where the fulfillment webhook has been published. It should look like Function URL (yourGame): https://us-central1-YOUR_PROJECT.cloudfunctions.net/yourGame. The command will also deploy the static assets at https://us-central1-YOUR_PROJECT.cloudfunctions.net/.

On running firebase deploy I can't find the "Function URL". It would just display "Hosting URL" and "Project Console". A screenshot is attached upon running "firebase deploy" on CLI.

And also what does it mean by "Now populate the database: node database.js"?

Saloni
  • 1
  • 1
  • Possible duplicate of [Can't find the function url for Firebase webhook in Google Assistant tutorial](https://stackoverflow.com/questions/46083838/cant-find-the-function-url-for-firebase-webhook-in-google-assistant-tutorial) – Bart Dec 20 '17 at 12:52
  • Only HTTP-triggered functions get a URL. Does your `index.js` declare any web hooks (functions that are triggered by a HTTP call)? If not, that would explain why you're not seeing a URL. – Frank van Puffelen Dec 20 '17 at 14:39
  • The index.js file is here: https://github.com/actions-on-google/dialogflow-trivia-game-nodejs/blob/master/functions/index.js – Saloni Dec 21 '17 at 08:21
  • Did you add the contents from the index.js from github before or after you did a `firebase init`? Can you show the contents of the dialogflow-trivia-game-nodejs folder and the contents of the "functions" folder under that? It sounds like you are missing the actual files from github - did you clone them? – Prisoner Dec 22 '17 at 12:43
  • Yes I added everything in the repository, and index.js is present in functions folder. – Saloni Dec 26 '17 at 14:13
  • Try running 'firebase deploy --only functions --debug' to get some more specific debug info. Also, the 'node database.js' note means that you should literally run 'node database.js' in your terminal to complete setup. The database.js file needs to be run with node. – Sachit Mishra Dec 27 '17 at 20:00

2 Answers2

1

Follow this Project Console URL.

You then should be in your project's dashboard, on the left side of the screen you gonna see a bunch of options, among them one called "Functions", click on it.

Your URL should be displayed there.

Bruno Araújo
  • 319
  • 4
  • 10
  • I did the same, but in "Functions", it tells me that I haven't yet added any function and asks me start adding functions by Clicking there. When I click there, it shows the CLI commands on how to add one. – Saloni Dec 22 '17 at 12:13
0

If you created a new Firebase project, then your index.js in your ./functions directory will look like this by default:

const functions = require('firebase-functions');

// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
//exports.helloWorld = functions.https.onRequest((request, response) => {
//   response.send("Hello World!");
//});

Make sure you uncomment the hellowWorld function. Then save your project. Then run firebase deploy. Then, the url will show up in your dashboard.

grantespo
  • 2,233
  • 2
  • 24
  • 62