erajasekar
Explore posts from serversGetting CancelledError Python FastAPI application using openai chat completion
async CancelledError.
Attaching the logs and source code of original application that is failing.
( minimal example version works fine after increasing token size, it's still not clear how it works on local with 512 token size and not from Railway ).
38 replies
Getting CancelledError Python FastAPI application using openai chat completion
This is based on what I find from troubleshooting. My goal to not to pin point problem with the platform and but to figure out a solution for my issue.
Let me know if this is something that could be resolved through support or I should move to another platform instead of spending time in trouble shooting this.
Thank you for being with me in debugging this.
38 replies
Getting CancelledError Python FastAPI application using openai chat completion
Hi @Brody , Is there any proxy used for outbound communication from Railway servers to external apis ?
I use a python library for extracting youtube transcripts which works fine in Railway, but it doesn't work in render.
When I researched further I found that youtube blocks requests from cloud machine servers and possible solution to get around is to use a proxy.
But youtube is not blocking requests from Railway
38 replies
Getting CancelledError Python FastAPI application using openai chat completion
hmm. Thank you for example. But it's sending events after every second. what happens when delay between events is more than 1 second and random. The example I provided has minimal code of my application and it is using openai's streaming sdk.
If you show if my minimal example working or help me troubleshoot, I would really appreciate.
Thank you for your support on weekend.
38 replies
Getting CancelledError Python FastAPI application using openai chat completion
FYI - I deployed same exact code on another clould provider render and it works fine https://streamingfastapiexample.onrender.com/.
I am guess that there is some http connection or timeout parameter we need to tweak on Railway.
38 replies
Getting CancelledError Python FastAPI application using openai chat completion
Thank you @Brody Here is minimal example to reproduce.
App url : https://streamingfastapiexample-production.up.railway.app/ - when you click streaming response will stream, but it will stop before finishing.
Code : https://github.com/erajasekar/StreamingFastAPIExample ( Use master branch)
38 replies
Getting CancelledError Python FastAPI application using openai chat completion
Thank you @Brody .
I tried lot of troubleshooting options today like changing from guvicorn to uvicorn , setting keep-alive timeout in uvicorn and refactoring code to handle timeout etc. But none of it worked.
Then, I installed docker and ran my app inside docker and it works perfectly fine.
I will attach debug logs from local and inside railway app to see if that helps.
I have spent whole day today trying to debug this and no luck. Any help will be greatly appreciated.
38 replies
Getting CancelledError Python FastAPI application using openai chat completion
@Brody I don't have this issue when running locally.
I also tried increasing async time out using middle ware and no luck.
The response streams only for few seconds
38 replies