N
Novu6mo ago
Rushi

Error of Monogo DB connection string

@Pawan Jain @Novu_Bot while docker-compose -f docker-compose.yml up then show below error [Nest] 921 - 07/04/2024, 7:08:02 AM ERROR [ExceptionHandler] querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net ws | Error: querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net ws | at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:240:17) below is our env file Secrets YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION used as a secret to verify the JWT token signature JWT_SECRET=XXXXXXXXXXX used to encrypt/decrypt the provider credentials STORE_ENCRYPTION_KEY=XXXXXXXXXX Host HOST_NAME=http://209.182.236.234 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://rocky:[email protected]/rocky_novu?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=$HOST_NAME:1600 API_ROOT_URL=$HOST_NAME:1600 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
5 Replies
Ask Inkeep
Ask Inkeep6mo ago
Hi @Rushi, 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 * API Reference * MacOS/Linux * Deploy with Docker ----------------------------- Answer Based on the error message and the environment file you've provided, it appears that there's an issue with the MongoDB connection string. The error suggests that the DNS resolution for the MongoDB cluster is failing. Let's address this issue step by step: 1. First, the error you're encountering is:
[Nest] 921 - 07/04/2024, 7:08:02 AM ERROR [ExceptionHandler] querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net
ws | Error: querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net
[Nest] 921 - 07/04/2024, 7:08:02 AM ERROR [ExceptionHandler] querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net
ws | Error: querySrv ESERVFAIL _mongodb._tcp.cluster0.8vyb3rm.mongodb.net
This error indicates that the DNS resolution for your MongoDB Atlas cluster is failing. (1) 2. In your environment file, you have the following MongoDB connection string:
MONGO_URL=mongodb+srv://rocky:[email protected]/rocky_novu?retryWrites=true&w=majority
MONGO_URL=mongodb+srv://rocky:[email protected]/rocky_novu?retryWrites=true&w=majority
Ask Inkeep
Ask Inkeep6mo ago
3. The issue might be related to DNS resolution within your Docker container. Here are a few things you can try: a. Ensure that your Docker container has proper network connectivity and can resolve DNS queries. b. Try using the MongoDB connection string without the SRV record. Replace mongodb+srv:// with mongodb:// in your connection string. c. If you're running this in a local development environment, you might need to adjust your Docker network settings or use a different DNS server. 4. To troubleshoot further, you can try the following: a. Verify that you can ping or nslookup the MongoDB host from within your Docker container. b. Check if there are any network restrictions preventing your Docker container from accessing external services. c. Ensure that the MongoDB Atlas cluster is properly configured and accessible from your network. 5. If the issue persists, you might want to consider using a local MongoDB instance for development purposes. You can update your docker-compose.yml file to include a MongoDB service and update the MONGO_URL in your .env file accordingly. (2) (1) If you're still unable to resolve this issue, I suggest clicking on the "Ask for help" button to tag a team member for further assistance, as they might have more specific insights into your deployment environment and Novu configuration.
Ask Inkeep
Ask Inkeep6mo ago
Feel free to tag @Ask Inkeep with additional questions. Got it. Tagging @Support for additional help.
Rushi
RushiOP6mo ago
@Pawan Jain Can you help on these issue?
Pawan Jain
Pawan Jain6mo ago
@Rushi I see you have created a post in #⚓│community-self-host channel. Can we please continue there?
Want results from more Discord servers?
Add your server