Firebase Cloud Functions - Creating a REST Endpoint with Cloud Functions

Academind · 123K views · 2018 · 24:09

Open on YouTube

Web developmentCloud, DevOps & reliabilitytutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a working reference for building HTTP endpoints and file-upload handlers with Firebase Cloud Functions.

Recommended by 1 people across 1 different months, 2019 to 2020.

What it is

A 24-minute Academind tutorial by Maximilian Schwarzmüller showing how to create a REST endpoint with Firebase Cloud Functions using HTTPS-triggered functions. It comes with an accompanying article and source code on GitHub.

What people said

Recommends Mateo Kruk · 2020-02 · Stack Overflow · on “Uploading audio files to Firebase Cloud Database and then redering it from the Database to React js + Endless loop issue”

I done this for a past project at work. You should use cloud functions and in react you will use form data to upload the files to the server. (You will upload your files to a cloud bucket and then you can modify the document with the link to that data!). Here some links: [this video] . There he makes a custom endpoint to upload data to the storage.

Cites user11066752 · 2019-02 · Stack Overflow · on “Firebase Rest API - Call signatures”

I'm trying to access the firebase cloud function using Rest API. Here is the test function: exports.test = functions.https.onRequest((req, res) => { console.log('came here'); res.status(200).json({"message":"it worked"}); }) I test using: curl 'https://<project_id>.firebaseio.com/test.json?auth=<auth_key> I expect the response to be {"message": "it worked"} But what I get back is: { "-LY...." : true, "-LY..": true } What am I doing wrong? Also is my endpoint like above or should it the cloudfunctions endpoint ( [LINK] <project-id.cloudfunctions.net/) as in this video [this video] Sadly cloudfunctions endpoint also did not work for me.

Cites Nickdacooldude · 2020-03 · Stack Overflow · on “Firebase function storage POST image issue”

I have encountered a problem when following a maximilian schwarzmüller course, which has otherwise been great: [this video] The image logs in the Firebase console as uploaded, recognises the type of file/size etc. But continually loads and never displays the image. I use a post request in POSTMAN to upload the image. When I upload manually to firebase on their UI, everything works fine. My code: const functions = require("firebase-functions"); const os = require("os"); const path = require("path"); const spawn = require("child-process-promise").spawn; const cors = require("cors")({ origin: true }); const Busboy = require("busboy"); const fs = require("fs"); const gcconfig = { projectId: "REDACTED

Cites Mr T · 2020-06 · Stack Overflow · on “Javascript to Typescript Conversion Error - Cloud Function”

I'm trying out my first Cloud Function following this guide ( [this video] ) which is written in JS, but instead writing in Typescript. I have created the following: // // Start writing Firebase Functions // // [LINK] // export const helloWorld = functions.https.onRequest((request, response) => { if (request.method !== 'POST') { return response.status(500).json({ message: 'Not allowed' }); } response.status(200).json({ message: 'Hello World!' }); }); However, the linter gives me the following error: Argument of type '(request: Request, response: Response) => Response | undefined' is not assignable to parameter of type '(req: Request, resp: Response) => void | Promise'. Type 'Response | undefined'