langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
52.94k stars 7.73k forks source link

console/api/setup 404 #11155

Closed L1n111ya closed 4 hours ago

L1n111ya commented 4 hours ago

Self Checks

Dify version

0.12.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

docker compose up -d

[+] Running 9/9 ✔ Container docker-web-1 Running 0.0s ✔ Container docker-sandbox-1 Running 0.0s ✔ Container docker-redis-1 Running 0.0s ✔ Container docker-ssrf_proxy-1 Running 0.0s ✔ Container docker-weaviate-1 Running 0.0s ✔ Container docker-db-1 Running 0.0s ✔ Container docker-worker-1 Running 0.0s ✔ Container docker-api-1 Running 0.0s ✔ Container docker-nginx-1 Started

✔️ Expected Behavior

No response

❌ Actual Behavior

截屏2024-11-27 10 38 19
L1n111ya commented 4 hours ago

I changed the ports of NGINX to 81 and 443, and deployed them on the server, using the port of VSCode to forward and access them in the local browser https://localhost:3000

dosubot[bot] commented 4 hours ago

Hey @L1n111ya! 👋 I'm here to help you with any bugs, questions, or contributions. Let's squash those bugs together!

I found a similar closed issue where a 404 error occurred when creating an app from a template in a self-hosted environment. The issue was resolved by modifying the docker-compose.yml file to adjust the API environment variables, specifically APP_WEB_URL and SERVICE_API_URL, to include the correct URL with the IP and the Nginx exposed port [1].

For your specific issue with the /console/api/setup endpoint returning a 404 error, consider the following steps:

  1. Check Nginx Configuration: Ensure that your Nginx configuration is correctly set up to forward requests to the appropriate service. Since you've changed the ports to 81 and 443, verify that these changes are reflected in your Nginx configuration files.

  2. Update Environment Variables: Make sure that the environment variables in your docker-compose.yml or .env file are correctly set. Specifically, check CONSOLE_API_URL, CONSOLE_WEB_URL, SERVICE_API_URL, APP_API_URL, and APP_WEB_URL to ensure they point to the correct URLs and ports.

  3. Verify Docker Setup: Use the command docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' to get the correct IP addresses for your services and update your Nginx configuration accordingly [2].

  4. Check for HTML Responses: The SyntaxError: Unexpected token '<' suggests that an HTML response was received instead of JSON. This might indicate that the request is not reaching the correct API endpoint. Double-check your routing and ensure that the API service is running and accessible.

  5. Restart Services: After making changes, restart your Docker services with docker compose down followed by docker compose up -d to apply the changes.

These steps should help resolve the 404 error you're encountering with the /console/api/setup endpoint.

To continue talking to Dosu, mention @dosu.

crazywoola commented 4 hours ago

3001 is front end endpoint. You are requesting this url for backend services, of course it will failed, please read the docs before changing the ports. Make sure you understand how the port works in docker environment.

L1n111ya commented 1 hour ago
截屏2024-11-27 14 09 30

Thank you for reply! Which port is backend services?