Heya! My team is trying to deploy multiple Panel widgets within a FastAPI application. So far, we followed the instructions about deploying with FastAPI, but we’re having trouble getting everything loading properly on our hosting platform Render.
You can check out the code here: GitHub - technologiestiftung/innovationserhebung (the main.py
file is in the /app
directory)
When running the project locally, everything renders correctly.
Then, on Render we’re running this command to start the server (with PORT
being 8000
):
cd app/; uvicorn main:app --host 0.0.0.0 --port $PORT
… but when accessing the page, the panel widgets can’t be loaded (403 error when trying to load their JS files). If I allow all origins via something like allow_websocket_origin=["0.0.0.0:8000"],
inside pn.serve()
, the widgets’ JS can be loaded, but they will immediately lose their web socket connection and not properly load either. This error would be shown:
[bokeh] Failed to load Bokeh session d0Zknpdyni02egdKY6OkIy72OwZeyubBTAQkaa6wSzPo: Error: Lost websocket connection, 1006 ()
I suspect it’s a configuration issue, maybe something around the allow_websocket_origin
parameter of pn.serve()
, but I cannot find a configuration that works.
Can anyone give me a hint of what might fix the issue? Any support is greatly appreciated!