Closed lukasa1993 closed 3 months ago
Hello, the API_BASE_URL is used by the web frontend to know where to connect to, the server always listens to localhost:3000
yea i am referring to front end it always goes to localhost:3000 it ignores API_BASE_URL
env variable
Are you running it from inside docker? the mechanism for the connection relies to the status script that runs the loadEnv, creating an env-config.js that is provided to the browser. can you check the content of this file? yourwebinstance/env-config.js is it set properly?
this is how i run it
expo_update_web:
image: ghcr.io/umbertoghio/self-hosted-expo-updates-server-web:latest
user: root
container_name: expo_update_web
restart: always
volumes:
- ./expo/web:/expo
environment:
- API_BASE_URL=https://expo.example.com
- ENVIRONMENT=production
networks:
- lnh
command: /expo/start.sh
i don't see env-config.js
file inside docker container at least not at root level
Probably this part is missing from your start.sh
the loadEnv script generates the env-config.js , then places it in the root folder to be picked up by the browser
oh if i cat /usr/share/nginx/html/env-config.js
it has this
window._env_ = { API_BASE_URL: 'http://localhostu:3000', ENVIRONMENT: 'development' }
Simple question, why we are constrained to use an Nginx variable ? Why not simply pass the api url with the web server of the frontend? I use NginxProxyManager, and it's not verry easy to setup. Thank you also for this verry useful tool :)
Hello, @lukasa1993 sorry, I missed your last message, have you managed to solve it?
@EliotAmn It is not an nginx variable, the variable is set in the env of the docker running the web server, on startup this url is picked up and set inside a .JS file that is sent to the user's browser. So this is how the JS running in the browser knows where to connect to.
Feel free to fork the project and hardcode your URL in the JS client.
Hope that helps
Hello,
@lukasa1993 sorry, I missed your last message, have you managed to solve it?
@EliotAmn
It is not an nginx variable, the variable is set in the env of the docker running the web server, on startup this url is picked up and set inside a .JS file that is sent to the user's browser.
So this is how the JS running in the browser knows where to connect to.
Feel free to fork the project and hardcode your URL in the JS client.
Hope that helps
not with config i edited container manually but with config i couldn't solve it
This is an extract of my production docker-compose.yml
self_hosted_expo_updates_server_web:
image: ghcr.io/umbertoghio/self-hosted-expo-updates-server-web:latest
container_name: self_hosted_expo_updates_server_web
restart: always
depends_on:
- self_hosted_expo_updates_server_api
ports:
- 4748:8080 # Put this behind an https reverse proxy if you want to use it in production
environment:
- API_BASE_URL=https://to-api.my-private-domain.fr # URL of the API server
But :
Yes i can edit js files directly, but i want to sometime pull the repo, and it can cause conflicts issues.
Let me investigate it, seems that there's something wrong with the image
The last PR had a switch to rootless nginx, good idea but I forgot to check the loadEnv script, I've committed a fix and a new docker image is available without this problem. Have a nice day!
I'm sorry but I have pull your new images, and the problem still here... The web console try again to connect to ws://localhost:3000. I have re-clone the repo, and repull all images. When I try to use it in development mode, I got this error on start:
and the web interface like that :
I have an other error, but I think it's another issue :
Strange issue, I just started from master and development docker-compose started just fine, the issue I fixed was in the production environment.
you may investigate the startup-dev script, this is what I have:
Oh, I see, case sensitivity issue on Deploy / deploy, committed the fix
Ok it's good for the env issue. Thank you very much ! But the server-side error still here : Good luck haha :)
{
"level":50,
"time":1722606778617,
"pid":1,
"hostname":"269b883a4368",
"msg":"TypeError: Cannot read properties of undefined (reading 'find')\n at Object._find (/home/node/server/node_modules/feathers-mongodb/lib/index.js:123:26)\n at callMethod (/home/node/server/node_modules/@feathersjs/adapter-commons/lib/service.js:13:22)\n at Object.find (/home/node/server/node_modules/@feathersjs/adapter-commons/lib/service.js:63:16)\n at /home/node/server/node_modules/@feathersjs/feathers/lib/hooks/index.js:57:33\n at new Promise (<anonymous>)\n at /home/node/server/node_modules/@feathersjs/feathers/lib/hooks/index.js:54:27\n at async Object.find (/home/node/server/src/services/status.js:17:22)"
}
that seems just a missing record from the db, you may ignore it
trying to use docker production version and web
API_BASE_URL
doesn't change url in network logs it still localhost:3000