Skip to content

Unable to get firebase app to deploy a simple web request using python's Flask #1180

Answered by mnjuhn
mnjuhn asked this question in Q&A
Discussion options

You must be logged in to vote

I found what I was missing to get the firebase cloud function working using python's Flask library. I had to register the flask app to use https_fn wrapper. Here is the code which now works when doing a firebase deploy

import firebase_admin
from firebase_admin import credentials, firestore
from flask import Flask, request
from firebase_functions import https_fn
from cancer import get_cancer

# Initialize Firebase Admin SDK
cred = credentials.Certificate("serviceAccountKey.json")
firebase_admin.initialize_app(cred)
db = firestore.client()

app = Flask(__name__)

@app.route('/test', methods=['GET'])
def test():
    print("Hello World")
    return "Hello World"

# Main entry point for Fireba…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mnjuhn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant