FRONT_BASE_URL: Invalid url: "$HOST_NAME:4200"
I deploy Novu on VPS. It is my .env file
JWT_SECRET=eadfce9325ddac90fde6011b494871ac089a048606efe1f5c109409bbb278278e7b7adf65fc6d18c5e1921692d5e6dc13722d1ba1be3e28899983b5d1dc9e644
STORE_ENCRYPTION_KEY=12345678912345678912345678912345
HOST_NAME=http://my-ip-address
available values 'dev', 'test', 'production', 'ci', 'local'
NODE_ENV=dev
MONGO_MAX_POOL_SIZE=200
MONGO_MIN_POOL_SIZE=100
MONGO USER
MONGO_INITDB_ROOT_USERNAME=root
MONGO PASSWORD
MONGO_INITDB_ROOT_PASSWORD=TopSEcretPasS2228HeroHzNovu
MONGO_URL=mongodb://root:TopSEcretPasS2228HeroHzNovu@mongodb:27017/novu-db?authSource=admin
REDIS_HOST=redis
DOCKER_REDIS_SERVICE_PORT=6379
REDIS_PASSWORD=123456789
REDIS_CACHE_SERVICE_HOST=redis
S3_LOCAL_STACK=$HOST_NAME:4566
S3_BUCKET_NAME=novu-local
S3_REGION=eu-east-1
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=testTestPassNovuSecretHzPass
API_PORT=3000
REDIS_PORT=6379
REDIS_CACHE_SERVICE_PORT=6379
WS_PORT=3002
REACT_APP_WS_URL=$HOST_NAME:3002
REACT_APP_API_URL=http://localhost:3000
API_ROOT_URL=$HOST_NAME:3000
DISABLE_USER_REGISTRATION=false
FRONT_BASE_URL=$HOST_NAME:4200
WIDGET_EMBED_PATH=$HOST_NAME:4701/embed.umd.min.js
WIDGET_URL=$HOST_NAME:4500
IS_MULTI_TENANCY_ENABLED=true
And I get error FRONT_BASE_URL: Invalid url: "$HOST_NAME:4200" when I deploy on VPS.
For my local deployment The only change was in these two lines:
HOST_NAME=http://localhost
NODE_ENV=local
Also I incommented this line
REACT_APP_API_URL=http://localhost:3000.
And everything worked fine.
3 Replies
Hi @Kh. M-S., I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* Run Novu in local machine
* Deploy with Docker
* Windows
* MacOS/Linux
-----------------------------
Answer
It seems like the issue you're encountering with the
FRONT_BASE_URL
in your .env
file is related to the way the environment variable HOST_NAME
is being parsed or not being parsed correctly in your deployment environment. The error message indicates that the variable substitution for $HOST_NAME
is not being processed, and instead, it's being treated as a literal string.
To resolve this issue, you should ensure that your environment correctly supports the use of such variable interpolations. Here are a few steps you could take:
1. Check Environment Variable Support: Make sure that the system where you're deploying Novu supports the syntax you're using for environment variables. Some systems might require a different format or method to parse variables.
2. Directly Set the URL: As a workaround, you could directly set the URL in the FRONT_BASE_URL
without using the HOST_NAME
variable:
3. Ensure Correct Parsing: If you wish to continue using the HOST_NAME
variable, ensure that wherever you're configuring or parsing your environment variables (possibly in a Dockerfile, a startup script, or application configuration), it supports and correctly handles variable substitution.
4. Debugging: Temporarily add logging or print statements in your configuration loading logic to print out the values of environment variables to ensure they are being set as expected.
5. Configuration File: If you are using Docker or another containerization tool, ensure your .env
file is correctly referenced in your docker-compose.yml
or the relevant configuration file and that the service configuration allows for environment variable substitution.
These steps should help you identify and resolve the issue with the FRONT_BASE_URL
configuration in your .env
file. Make sure that your deployment environment is configured to handle environment variables correctly as they seem to work in your local environment.
Glad I could be helpful. Feel free to create a new thread with any new questions you may have.keep
REACT_APP_API_URL
commented and use NODE_ENV=production
Make sure HOST_NAME=http://localhost
without trailing /
@Pawan Jain Yes! It works now! Thanks!