npm install -g firebase-tools
firebase login
cd functions/
npm i
npm test
Some of these functions refer to the Firebase remote configuration but they need authorization to do so. You will need to generate a new Firebase Admin SDK private key and move it into the following folder:
functions/src/keys/
firebase functions:config:set auth.key.filename="<you_firebase_sdk_private_key_filename>" # This is the private key that you generated above. Ex: flutter-weather-firebase-adminsdk.json
firebase functions:config:set project.id="<your_firebase_project_id>"
firebase functions:config:set openweathermap.key="<your_openweathermap_api_key>"
firebase functions:config:get
npm run deploy-functions
npm run deploy-hosting
npm run deploy-firestore-rules
functions/
firestore/
name/
onWrite.f.ts
name2/
onCreate.f.ts
name3/
onUpdate.f.ts
name4/
onCreate.f.ts
onUpdate.f.ts
onDelete.f.ts
http/
name/
endpointName.f.ts
schedule/
jobName.f.ts
index.ts
When you deploy these functions a lib/ folder will be generated that contains the transpiled javascript files that get deployed to firebase. It is highly recommended to delete this folder if it exists prior to deploying the functions. This will ensure that a clean build is being deployed.