Skip to content
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

functions can't finish execute when its response "Content-Type" is "text/plain" or "text/html" #16

Open
karheng opened this issue Aug 24, 2017 · 6 comments
Labels

Comments

@karheng
Copy link

karheng commented Aug 24, 2017

@MartinSahlen Based on the logs, there is response payload. However, the function seems continue running, can't finish execute until encounter "connection error". Thus, can't get the response from the functions URL.

image

from cloudfn.flask_handler import handle_http_event
from flask import Flask, request, Response

app = Flask('the-function')

@app.route('/run', methods=['GET'])
def testrun():
    return Response(str(123456), mimetype='text/plain')

handle_http_event(app)
@MartinSahlen
Copy link
Owner

MartinSahlen commented Aug 25, 2017

@karheng Thanks for submitting issue. Are you able to run this with a json response body and string just to see if we can zone in on where the issue might be?

@karheng
Copy link
Author

karheng commented Aug 29, 2017

@MartinSahlen Yes, when is json response body, function will finish execute immediately once the response returned.

image

@MartinSahlen
Copy link
Owner

MartinSahlen commented Aug 29, 2017

@karheng , I'll have a a look! Thanks for providing the info! Wondering if this is related to the fact that the body in the first request you posted that failed seems to be an integer and not a string, and if I'm doing something wrong in the parsing / unparsing.

@karheng
Copy link
Author

karheng commented Aug 29, 2017

@MartinSahlen You're right! I tested with string, it's working fine.
However, I did convert the integer to string, still can't work (above python code).
image

@MartinSahlen
Copy link
Owner

Yes! I was just trying to locate where the error might be. You did convert the number correctly, however my code does not seem to handle serialization correctly. So I just needed to see that, makes it a lot easier for me to fix the issue. It should be a fast fix, thanks for helping debug.

@MartinSahlen
Copy link
Owner

I'll have a look at this during the weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants