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.

Screenshot 2024-12-16 at 10 09 10 AM

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

  1. Install bolt.diy on a different box form the Ollama server
  2. Configure the URL in the .env.local file
  3. start the bolt.diy server
  4. 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

Screenshot 2024-12-16 at 10 09 10 AM

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

Most upvoted comments

I think bolt can help with this issue in a few ways…

  1. Fix inconsistencies between environment variables and values set in .env.local and .env files. 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 .env in prod and not .env.local). This should be straight forward, set values in .env.local and then load up bolt, the default values when the client does not have any, should be what is set in the .env.local.
  2. If some of the calls to ollama will come from the server then all calls to ollama should come from the server, do not split the responsibility between server and client.

If, for whatever reason, you cannot move all communication with ollama to server-side, at the very least, mention OLLAMA_ORIGINS in 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 of OLLAMA_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.