0
votes

Deploying 3 simple functions over firebase project to get started with and expecting their respective URLs after deploying but getting no url.

Here is the code:

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

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

exports.helloWorldTwo = functions.https.onRequest((request, response) => {
response.send("Hello 2 from Firebase!");
});

exports.helloWorldThree = functions.https.onRequest((request, response) =>{
response.send("Hello 3 from Firebase!");
});

Output:

D:\IOT\DialogFlow\firebase functions>firebase deploy

=== Deploying to 'fir-functions-22d02'...

i deploying functions Running command: npm --prefix ./functions/ run lint

functions@ lint D:\IOT\DialogFlow\firebase functions\functions eslint .

  • functions: Finished running predeploy script. i functions: ensuring necessary APIs are enabled...
  • functions: all necessary APIs are enabled i functions: preparing functions directory for uploading...

  • Deploy complete!

Please note that it can take up to 30 seconds for your updated functions to propagate. Project Console: https://console.firebase.google.com/project/fir-functions-22d02/overview

I have tried the following:

- Deleting "npm --prefix \"$RESOURCE_DIR\" run lint".  

- Deleting complete "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ]

Replaced the code with following:

-  {
  "functions": {
    "predeploy": [
      "npm --prefix ./functions/ run lint"
      "npm --prefix ./functions/ run build"
    ]
  }
}

- {
  "functions": {
    "predeploy": [
      "npm --prefix ./functions/ run lint"
    ]
  }
}

None of them worked.

1
Most likely your functions are not recognized as HTTP-triggered functions. Add the minimal code to your question (there's an edit link under it) if you want help in troubleshooting why that is.Frank van Puffelen

1 Answers

1
votes

I just deleted the comments from the code and deployed it again. It worked!

Here is the output:

functions@ lint D:\IOT\DialogFlow\firebase functions\functions eslint .

  • functions: Finished running predeploy script. i functions: ensuring necessary APIs are enabled...
  • functions: all necessary APIs are enabled i functions: preparing functions directory for uploading... i functions: packaged functions (53.58 KB) for uploading
  • functions: functions folder uploaded successfully i functions: creating Node.js 6 function helloWorld(us-central1)... i functions: updating Node.js 6 function helloWorldTwo(us-central1)...

The following functions are found in your project but do not exist in your local source code: helloWorldOne(us-central1)

If you are renaming a function or changing its region, it is recommended that you create the new function first before deleting the old one to prevent event loss. For more info, visit https://firebase.google.com/docs/functions/manage-functions#modify

? Would you like to proceed with deletion? Selecting no will continue the rest o f the deployments. Yes i functions: deleting function helloWorldOne(us-central1)... + functions[helloWorldOne(us-central1)]: Successful delete operation. + functions[helloWorld(us-central1)]: Successful create operation. Function URL (helloWorld): https://us-central1-fir-functions-28de9.cloudfunctions.net/helloWorld + functions[helloWorldTwo(us-central1)]: Successful update operation.

  • Deploy complete!

Please note that it can take up to 30 seconds for your updated functions to propagate. Project Console: https://console.firebase.google.com/project/fir-functions-28de9/overview