Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to connect to the server #656

Open
zidanereal5 opened this issue Feb 28, 2025 · 11 comments
Open

Failed to connect to the server #656

zidanereal5 opened this issue Feb 28, 2025 · 11 comments
Labels
bug Something isn't working

Comments

@zidanereal5
Copy link

Describe the bug
Fresh deployment of the version v1.9.3 with Docker method.
Error msg:
Failed to connect to the server. Please try again later.

Image

To Reproduce
Steps to reproduce the behavior:

  1. setting of docker-compose.yaml
    searxng:
    ports:
    • 7002:8080

perplexica-backend:
ports:
- 7001:3001

perplexica-frontend:
ports:
- 7000:3000

  1. setting of config.toml
    [MODELS.OLLAMA]
    API_URL = "http://10.2.147.70:11434" # Ollama API URL - http://host.docker.internal:11434

[API_ENDPOINTS]
SEARXNG = "http://10.2.147.70:7002" # SearxNG API URL localhost:32768 10.2.147.70:7002

  1. logs of perplexica-frontend
    yarn run v1.22.22


$ next start

▲ Next.js 14.1.4

✓ Ready in 313ms
5. logs of perplexica-backend
yarn run v1.22.22

$ npm run db:push && node dist/app.js

[email protected] db:push

drizzle-kit push sqlite

drizzle-kit: v0.22.7

drizzle-orm: v0.31.2

No config path provided, using default path

Reading config file '/home/perplexica/drizzle.config.ts'

[⣷] Pulling schema from database...

[✓] Pulling schema from database...

[i] No changes detected

info: WebSocket server started on port 7001

info: Server is running on port 7001

@zidanereal5 zidanereal5 added the bug Something isn't working label Feb 28, 2025
@zidanereal5
Copy link
Author

ollama api and searxng api works well.

@ItzCrazyKns
Copy link
Owner

Hey please follow this: https://github.com/ItzCrazyKns/Perplexica/blob/master/docs/installation/NETWORKING.md

Where you update your IP make sure it matches the port as well, it shall work.

@Krzysi3k
Copy link

Krzysi3k commented Mar 2, 2025

I had the same issue, check your config.toml file, you should have OpenAI config as follow:

[MODELS.OPENAI]
  API_KEY = "sk-xxxxxx..."

if you don't have that, add your OpenAI key manually via web ui, it should automatically update your config.toml

Image

@zidanereal5
Copy link
Author

zidanereal5 commented Mar 3, 2025

Hey please follow this: https://github.com/ItzCrazyKns/Perplexica/blob/master/docs/installation/NETWORKING.md

Where you update your IP make sure it matches the port as well, it shall work.

I have changed the docker-compose.yaml file.
Have replaced 127.0.0.1 with the server IP:

args:

But still not working.

@zidanereal5
Copy link
Author

sk-xxxxxx...

Have input the Ollama URL, that should be enough.

[MODELS.OLLAMA]
API_URL = "http://10.2.147.70:11434"

Otherwise I cannot open the web ui for the key setting.

@skapytek
Copy link

skapytek commented Mar 7, 2025

same error for me. Was running the docker compose as written in the turorial without changing any ports or settings. Ive only added my openai api key and renamed the toml.config file.

@ItzCrazyKns
Copy link
Owner

Hey please follow this: https://github.com/ItzCrazyKns/Perplexica/blob/master/docs/installation/NETWORKING.md
Where you update your IP make sure it matches the port as well, it shall work.

I have changed the docker-compose.yaml file. Have replaced 127.0.0.1 with the server IP:

args:

But still not working.

Did you run docker compose up -d --build?

@ItzCrazyKns
Copy link
Owner

same error for me. Was running the docker compose as written in the turorial without changing any ports or settings. Ive only added my openai api key and renamed the toml.config file.

Can you please provide logs from the browser console and the containers?

@loosac
Copy link

loosac commented Mar 9, 2025

Hi, i got same issues: hardcoded 127.0.0.1:3001 is inside .js files. My workoround:

First -ensure everywhere in variables inside files fetched from git you changed variables to desired IP

next build the app : docker compose up -d

then run console from frontend container:

docker exec -it perplexica-perplexica-frontend-1 /bin/sh

instide container bash (replace yYOURVALIDIP with desired IP):

for i in `grep '127.0.0.1:3001/' -r . |grep -v cache | cut -d ':' -f1 | sort -u`
do
sed -i 's/127.0.0.1:3001/YOURVALIDIP:3001/g' $i
done

exit

then commit changes done inside container

docker commit perplexica-perplexica-frontend-1

if you did a connection before -clear cache in your browser or try in private mode.

Image

@loosac
Copy link

loosac commented Mar 9, 2025

same error for me. Was running the docker compose as written in the turorial without changing any ports or settings. Ive only added my openai api key and renamed the toml.config file.

Can you please provide logs from the browser console and the containers?

Man, problem is inside .js files in web app. It probably everything works fine -when run from same machine, where perplexica is running. But when docker server is another machine and client connects via network -then issues starts to occur.

@ItzCrazyKns
Copy link
Owner

same error for me. Was running the docker compose as written in the turorial without changing any ports or settings. Ive only added my openai api key and renamed the toml.config file.

Can you please provide logs from the browser console and the containers?

Man, problem is inside .js files in web app. It probably everything works fine -when run from same machine, where perplexica is running. But when docker server is another machine and client connects via network -then issues starts to occur.

Its not a problem but rather a feature of NextJS. It embeds the public environment variables in the Javascript code generated, your method of changing the IP is correct but its not recommended because in case something wrong happened during the execution the Javascript bundle might break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants