3

I'm new using Firebase Functions, I'm trying to set up the functions for Firebase in order to set up notifications for common activities in my app, I'm following the steps suggested by firebase(see below), however the Function folder is generated in the wrong path(see below) and the firebase functions screen stills asks for the setup.

The Function folder is supposed to be created in my project folder, how can I solve this issue?

1: $ npm install -g firebase-tools 2: $ firebase init 3: $ firebase deploy

C:\Users\BAQ-229\AndroidStudioProjects\reviu\Functions>firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  C:\Users\BAQ-229

Before we get started, keep in mind:

  * You are initializing in an existing Firebase project directory

? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices. Functions: Configure and deploy Cloud Functions

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

i  .firebaserc already has a default project, using jobly-b45bf.

=== Functions Setup

A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.

? What language would you like to use to write Cloud Functions? JavaScript
? Do you want to use ESLint to catch probable bugs and enforce style? Yes
+  Wrote functions/package.json
+  Wrote functions/.eslintrc.json
+  Wrote functions/index.js
+  Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes

> protobufjs@6.10.1 postinstall C:\Users\BAQ-229\functions\node_modules\protobufjs
> node scripts/postinstall

npm notice created a lockfile as package-lock.json. You should commit this file.
added 361 packages from 266 contributors and audited 361 packages in 12.507s

32 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

+  Firebase initialization complete!

C:\Users\BAQ-229\AndroidStudioProjects\reviu\Functions>firebase deploy

=== Deploying to 'jobly-b45bf'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint C:\Users\BAQ-229\functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
+  functions: required API cloudbuild.googleapis.com is enabled
+  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing functions directory for uploading...

+  Deploy complete!

Project Console: https://console.firebase.google.com/project/jobly-b45bf/overview
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Alfonso Angulo
  • 454
  • 2
  • 7
  • 16

1 Answers1

2

By looking at the output from the console you're inside the Functions folder. Go one level up on your main project folder (C:\Users\BAQ-229\AndroidStudioProjects\reviu) and run the commands from there, after they're finished, it will create a new folder called functions where the skeleton of your Cloud Functions will reside

Update: It seems that you created a firestore project before on the C:\Users\BAQ-229, to avoid the creation of the structure inside this directory:

  1. Locate and delete the firebase.json file in your C:\Users\BAQ-229 directory or in any other subdirectory under it
  2. Run again the firebase init command in the C:\Users\BAQ-229\AndroidStudioProjects\reviu\ directory (which I supposed is your main project folder)
Emmanuel
  • 1,436
  • 1
  • 11
  • 17
  • Already did it but it is creating the Functions folder in C:\Users\BAQ-229 – Alfonso Angulo Aug 14 '20 at 23:31
  • This answer solved my issue, I had to delete the firebase.json file in my n your C:\Users\BAQ-229 and run again Firebase init in the C:\Users\BAQ-229\AndroidStudioProjects\reviu\ directory, thanks a lot! – Alfonso Angulo Aug 14 '20 at 23:58
  • Excellent, if the answer resolved your issue, please feel free to accept the answer so the community will benefit from it – Emmanuel Aug 17 '20 at 15:32