-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firebase use flask route get "ECONNRESET" ,The restful api never response until 60s timeout #159
Comments
I'm having the same problem when i call flask.request.get_data() in post
stuck in read and then timeout. if post with no body, it's fine. By the way , i use the firebase emulators |
I found a temporary solution.
then use g.request in post function
|
Hello @fzrcyc. I am doing a POST request to the URL both through the emulator and on a live deployment using the following command: # Example for request to local emulator
curl -X POST http://127.0.0.1:5001/ff-test-74aeb/asia-south1/httpsflaskexample/api/test -d '{"key": "value"}' -H "Content-Type: application/json" I get the following response back: {"Message":"Hello World"} This is the code I have in my from firebase_functions import https_fn, options
import flask
from flask import jsonify
app = flask.Flask(__name__)
@app.post("/api/test")
def stuff():
abc = flask.request.get_data()
# abc= flask.request.get_json();
print("Jsondata:", abc)
# name = flask.request.args.get('name')
# print("name:", name)
data = {'Message': 'Hello World'}
return jsonify(data), 200
options.set_global_options(
max_instances=10, region=options.SupportedRegion.ASIA_SOUTH1)
@https_fn.on_request()
def httpsflaskexample(req: https_fn.Request) -> https_fn.Response:
with app.request_context(req.environ):
return app.full_dispatch_request() Could you please provide a reproducible example for this issue as I cannot reproduce it using the code sample you provided? |
Same issue with request.json which calls get_json |
A sample like firebase_documents
If i remove request.get_data(), It will be ok.
The text was updated successfully, but these errors were encountered: