Hi
I have been trying to resolve this issue for some time but I cannot get around it.
I was able to successfully deploy a Flask application and get into the Log-in page successfully. But when after submitting the log-in credentials I get a Bad Request error.
From the logs I can see that my login endpoint is executed with a GET request but not with the POST.
My feeling is that the issue might be around csrf tokens and maybe the way I set-up the environment variables, but I am not sure.
Do you think you can help narrowing down the problem? Have you seen the same or similar issue in the past?
Many thanks
Hi there,
As this looks like an issue specific to Flask, I recommend reaching out to a community that specializes in that area for assistance, or at least doing some online research about the error. That being said, here is a Stack Overflow thread I found that might help get you started: https://stackoverflow.com/questions/8552675/form-sending-error-flask.
Hope that helps!
Regards,
Mike
Render Support Engineer, MT (UTC-7)
Hi Mike
thanks for your prompt response. While I would agree this might be something specific to Flask app, the challenge I have is that I cannot get the relevant logs to investigate further the matter. As I mentioned at the beginning, it seems the endpoint is not even called, so the thread you mentioned is not applicable in this case.
It seems the issue might be related to csrf token, but so far I have not found a way to verify that and I was wondering if you have any suggestion
thanks
Hi Marco,
Just so I understand correctly, it sounds like the core problem here is that your Flask login page form submission is only making a GET
call and not a POST
call as well? Is that correct, or am I misunderstanding something?
Regards,
Mike
Render Support Engineer, MT (UTC-7)
Hi Mike
no the login as well as signup pages can make both GET and POST calls. The GET calls will render the page correctly but when submitting the login or signup form in the page then the error 400 occurs.
I was able to get more details about the message associated with the error and it seems that the CSRF session token is missing. At this stage I am not sure why this is happening in production and not in local environment.
If you have any hints you are more than welcome 
Thanks
Hi Marco,
Gotcha, thanks.
Unfortunately I am not very familiar with Flask, so your best bet is to do some further online research to see if anyone else has run into this issue. Here are a few threads I found that may help a bit:
Regards,
Mike
Render Support Engineer, MT (UTC-7)
Hi Mike
I really appreciate your support her. I will take a look the links you sent and see if I can figure out the solution
Many thanks