Getting Started with Cloud Functions for Firebase using TypeScript - Firecasts

Firebase · 406K views · 2018 · 9:28

Open on YouTube

Cloud, DevOps & reliabilityWeb developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the standard first walkthrough for setting up and deploying Cloud Functions with TypeScript, often when answering beginner setup and deployment questions.

Recommended by 9 people across 10 different months, 2018 to 2023.

What it is

A 9-minute official Firecasts tutorial from the Firebase team on writing Cloud Functions for Firebase in TypeScript. It walks through project setup with the Firebase CLI, writing a simple function, and deploying it.

What people said

Strong rec Richardson · 2022-10 · Stack Overflow · on “How do I force Firebase Cloud Functions to use ESLint?”

This Video below is a great starter on how to set up your cloud functions including your mentioned eslint, typescript, very informative Explanation [this video]

Recommends cutiko · 2018-04 · Stack Overflow · on “Migrate existing Firebase data”

If there is no real front end then: If the database is small and you are using the RTD then download the JSON and edit it If the database is large since you have no front end you should do it with Functions How to do it with Functions You have to create a Functions project that will have an HTTP request trigger, once you access that url, then the trigger will query the data and for each result will create new data. For doing this the simplest way to start is following this video [this video] . You have to do the same but instead of returning something to the browser with send, just end the Function with a code 200 (if it worked). I would recommend creating an extra node for verification something

Recommends James Poag · 2018-05 · Stack Overflow · on “Is it possible to get Apple Push Notifications with Firestore?”

You need to use Firebase Cloud Functions [LINK] with the FireStore triggers [LINK] . The first link has your use case. There are some great tutorial videos [this video] on Firebase's YouTube account. It even includes adding a Firestore Trigger.

Recommends Doug Stevenson · 2018-06 · Stack Overflow · on “firebase cloud functions - no deployment error, but not executing”

As Frank said, deploying a function doesn't execute the function. When you deploy an HTTP function, you will receive a URL for that function. The function runs when that url is accessed. On first deployment, that url is printed to the console. After that, you can see the full url by going to the Firebase console and finding your list of functions. Copy that url and paste it into your browser to see it work. You can also follow this guide to getting started with Cloud Functions for Firebase [this video] .

Recommends thanhbinh84 · 2019-03 · Stack Overflow · on “How to get a list of all files in Cloud Storage in a Firebase app?”

I faced the same issue, mine is even more complicated. Admin will upload audio and pdf files into storage: audios/season1, season2.../class1, class 2/.mp3 files books/.pdf files Android app needs to get the list of sub folders and files. The solution is catching the upload event on storage and create the same structure on firestore using cloud function. Step 1: Create manually 'storage' collection and 'audios/books' doc on firestore [LINK] Step 2: Setup cloud function Might take around 15 mins: [this video] Step 3: Catch upload event using cloud function import * as functions from 'firebase-functions'; import * as admin from 'firebase-admin'; admin.initializeApp(functions.config().firebase); cons

Recommends thanhbinh84 · 2019-04 · Stack Overflow · on “How to get a list of all files in Cloud Storage in a Firebase app?”

cloud firestore hasn't support flutter yet [LINK] The fast approach is writing API using cloud function, then accessing these API via restful as usual. It might take several hours to get familiar with cloud function, these training videos are quite easy to swallow :D [this video]

Recommends Elias Trizotti de Mattos · 2021-01 · Stack Overflow · on “Firebase Cloud Functions Best Practice?”

There is no "better way" to do these things than what is explicitly described in the official documentation, but I will try to help you with tips that have worked for me, considering the topics of your question (note that I use javascript to develop on the Cloud Functions, not Typescript): Initializing the admin SDK from an organized and dedicated directory can be a good idea: Do it and then import it to your index.js file. Why? This will keep your index.js file smaller, cleaner and focused on your Cloud Functions's exports. Bonus: I like to define the admin SDK as a global right after importing it on index.js. Handling globals in a smart way can improve your app performance and other benefi

Recommends user3651521 · 2021-05 · Stack Overflow · on “firebase callable function won't invoke”

There is a specific way using which a cloud function should be built to handle errors and promises, for example, there is no need to make the cloud function async. I think you will need to watch the tutorial series from Firebase team [this video] that will help you understand how each type of firebase function is made and how to write them. Your cloud function seems to be async here, so you will need to terminate it properly [LINK] as told by Firebase: resolve functions that perform asynchronous processing (also known as "background functions") by returning a JavaScript promise.

Recommends Dharmaraj · 2022-03 · Stack Overflow · on “Using es6 import statements in firebase functions”

The firebase-functions is meant to be used on server-side (in the Cloud function) and not in a client web app. To setup Cloud functions, create a new directory and run firebase init . Follow the instructions and setup Cloud Functions. The CLI will install all required modules and add a sample function like this: import functions from "firebase-functions"; exports.helloWorld = functions.https.onRequest((request, response) => { functions.logger.info("Hello logs!", {structuredData: true}); response.send("Hello from Firebase!"); }); Then you can call your cloud function [LINK] either by using Firebase SDK [LINK] or using Fetch API [LINK] . Also checkout Getting started with Cloud Functions for F

Recommends Agung · 2022-08 · Stack Overflow · on “why I can't change Typescript version even though I have downgraded the version”

fiuhhh....after 2 days, I finally find the solution I have to change the dependencies and also the devDependencies , especially these dependencies in the package.json "dependencies": { "firebase-admin": "^10.0.2", "firebase-functions": "^3.18.0", }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^5.12.0", "@typescript-eslint/parser": "^5.12.0", "eslint": "^8.9.0", "eslint-config-google": "^0.14.0", "eslint-plugin-import": "^2.25.4", "typescript": "^4.5.4" // <-- watch this version }, the problem is ....it seems to me that these dependencies is tightly coupled. it can easily break if it doesn't match. so my solution is to create new project just to copy and paste those dependencies