Subject: Need Help with MongoDB Connection Error in NestJS
api | [Nest] 452 - 07/03/2024, 1:57:03 PM ERROR [ExceptionHandler] querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net
api | Error: querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net
api | at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:275:17)
Unable to connect to mongodb in novu .env file. How to resolve this issue ?
9 Replies
Hi @Pooja, 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:
* Introduction to Novu
* Run Novu in local machine
* Introduction
* MacOS/Linux
-----------------------------
Answer
I apologize, but I couldn't find a direct answer to your specific MongoDB connection error in the provided information sources. However, I can provide some general guidance based on the available documentation:
1. Environment Variables: Make sure your MongoDB connection string is correctly set in the .env file. The correct format should be specified in the Novu documentation (1) .
2. MongoDB URL: Check if your MONGO_URL environment variable is correctly formatted. It should look something like this: mongodb://localhost/novu-db .
3. MongoDB Installation: Ensure that MongoDB is properly installed and running on your system. The Novu documentation provides instructions for setting up MongoDB (2) .
4. Connection Issues: If you're using a remote MongoDB instance (like MongoDB Atlas), make sure your network settings allow the connection and that the connection string is correct (3) .
5. Docker Setup: If you're using Docker, ensure that the MongoDB service is properly configured in your docker-compose file (1) .
If these suggestions don't resolve your issue, it might be helpful to review the full MongoDB connection configuration in your Novu setup.
Since I couldn't provide a direct solution to your specific error, I suggest you click on the "Ask for help" button to tag a team member who can review your question in more detail.
Feel free to tag @Ask Inkeep with additional questions.
for self hosting
Got it. Tagging @Support for additional help.
can you provide env file for that
Secrets
YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION
used as a secret to verify the JWT token signature
JWT_SECRET=aa5d69e46da930112b31f186b3dab3760b752219fa14ef4c55497f9bfefe5c52
used to encrypt/decrypt the provider credentials
STORE_ENCRYPTION_KEY=q0uDWbSIgiGCPP0PJcYPNW9Lh1U9X3Q5
Host
HOST_NAME=http://localhost
General
available values 'dev', 'test', 'production', 'ci', 'local'
NODE_ENV=production
MONGO_MAX_POOL_SIZE=200
MONGO_MIN_POOL_SIZE=100
MONGO USER
#MONGO_INITDB_ROOT_USERNAME=root
MONGO PASSWORD
#MONGO_INITDB_ROOT_PASSWORD=secret
MONGO_URL=mongodb+srv://charlie:[email protected]/charlie_stag?retryWrites=true&w=majority
REDIS_HOST=redis
DOCKER_REDIS_SERVICE_PORT=6379
REDIS_PASSWORD=
REDIS_CACHE_SERVICE_HOST=
AWS
S3_LOCAL_STACK=$HOST_NAME:4566
S3_BUCKET_NAME=novu-local
S3_REGION=us-east-1
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
Ports
API_PORT=1600
REDIS_PORT=6379
REDIS_CACHE_SERVICE_PORT=6379
WS_PORT=3002
Root URL
REACT_APP_WS_URL=$HOST_NAME:3002
Uncomment this one when deploying Novu in the local environment
as Web app local Dockerfile will have to load this to be used.
Deployment version doesn't need as we inject it with API_ROOT_URL value.
REACT_APP_API_URL=https://charlie-novu-api.cmdev.cc
API_ROOT_URL=https://charlie-novu-api.cmdev.cc
DISABLE_USER_REGISTRATION=false
FRONT_BASE_URL=https://charlie-novu.cmdev.cc
WIDGET_EMBED_PATH=$HOST_NAME:4701/embed.umd.min.js
WIDGET_URL=$HOST_NAME:4500
Context Paths
Only needed for setups with reverse-proxies
GLOBAL_CONTEXT_PATH=
WEB_CONTEXT_PATH=
API_CONTEXT_PATH=
WS_CONTEXT_PATH=
WIDGET_CONTEXT_PATH=
Analytics
SENTRY_DSN=
change these values
NEW_RELIC_APP_NAME=
NEW_RELIC_LICENSE_KEY=
IS_MULTI_TENANCY_ENABLED=false
modify this env file and please send
Novu Manage Platform
Novu Manage Platform
replyyy?????
@Pooja
Please continue this issue in #⚓│community-self-host channel post
https://discord.com/channels/895029566685462578/1258295712098156594
Please read support guidelines