bolt.diy: Non-local Ollama server Fail to connect
Describe the bug
In the ouput I keep getting the app-dev_1 | WARN Constants Failed to get Ollama models: fetch failed messages over and over. My setup is a bit different from most of the posts I see here as I am running a Ollama server on my local network. The URL is set in the .env.local file and it is being set in the UI from what I can tell because the UI seems to have a value set as you can see in the screenshot below.
This seems similar to #721 but the fix that worked for him is not working for me.
I know the Ollama server is running and ports are open since I also run an openwebui frontend from the same box I am trying to run bolt.diy from. In other words the route is tested every time I run a query in openwebui.
Additionally the model select dropdown is not populated with any options as I would expect if the connection was just full failing.
My architecture is pretty simple. Ollama server on local network-> Web server for Bolt.diy on different box on local network.
Link to the Bolt URL that caused the error
Not public accessable
Steps to reproduce
- Install bolt.diy on a different box form the Ollama server
- Configure the URL in the .env.local file
- start the bolt.diy server
- navigate to the UI and it should be broken
Expected behavior
I expected the bolt.diy frontend to be able to find the Ollama server
Screen Recording / Screenshot
Platform
- OS: Ubuntu
- Browser: Brave
- Version: bolt@0.0.1 dev
Provider Used
No response
Model Used
No response
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 39
I think bolt can help with this issue in a few ways…
.env.localand.envfiles. If you look through issues and even replies on this issue you will see a lot of confusion and conflicting advice when compared to documentation (ie use.envin prod and not.env.local). This should be straight forward, set values in.env.localand then load up bolt, the default values when the client does not have any, should be what is set in the.env.local.If, for whatever reason, you cannot move all communication with ollama to server-side, at the very least, mention
OLLAMA_ORIGINSin bolt documentation for ollama providers.@Jeevanhm Despite not running ollama in the container the solution is the same. Set the environment variable for the env where the ollama process runs. Alternatively you can run your browser with no security to verify that this is your problem, but I wouldn’t recommend doing this for any other reason. Example using chromium (on linux):
chromium-browser --disable-web-security --user-data-dir=/tmp/chrome. If bolt and ollama work with browser security disabled you need to figure out how to set the value ofOLLAMA_ORIGINS(for the ollama process) to the URL of your bolt instance.@mando222 Your issue seems to be similar to @k1rb’s one : the first error in your browser’s log is a CORS error between Bolt and Ollama. May be @k1rb solution (let Ollama allow Bolt UI URL as a valid CORS origin) will work.