None of DNS query names exist: _mongodb._tcp.., _mongodb._tcp..local

I’m getting below error, when I hit the url ‘http://127.0.0.1:5000/

Traceback (most recent call last):
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/pymongo/uri_parser.py”, line 287, in _get_dns_srv_hosts
results = resolver.query(’_mongodb._tcp.’ + hostname, ‘SRV’)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/dns/resolver.py”, line 1132, in query
raise_on_no_answer, source_port)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/dns/resolver.py”, line 1051, in query
raise NXDOMAIN(qnames=qnames_to_try, responses=nxdomain_responses)
dns.resolver.NXDOMAIN: None of DNS query names exist: _mongodb._tcp.., _mongodb._tcp..local.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1997, in call
return self.wsgi_app(environ, start_response)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1985, in wsgi_app
response = self.handle_exception(e)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask_cors/extension.py”, line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/_compat.py”, line 33, in reraise
raise value
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1982, in wsgi_app
response = self.full_dispatch_request()
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask_cors/extension.py”, line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/_compat.py”, line 33, in reraise
raise value
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1612, in full_dispatch_request
rv = self.dispatch_request()
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/flask/app.py”, line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File “/Users/piyushjha/mflix-python/mflix/api/movies.py”, line 26, in api_get_movies
None, page=0, movies_per_page=MOVIES_PER_PAGE)
File “/Users/piyushjha/mflix-python/mflix/db.py”, line 219, in get_movies
cursor = db.movies.find(query).sort(sort)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/werkzeug/local.py”, line 348, in getattr
return getattr(self._get_current_object(), name)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/werkzeug/local.py”, line 307, in _get_current_object
return self.__local()
File “/Users/piyushjha/mflix-python/mflix/db.py”, line 46, in get_db
MFLIX_DB_URI,
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/pymongo/mongo_client.py”, line 494, in init
res = uri_parser.parse_uri(entity, port, warn=True)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/pymongo/uri_parser.py”, line 399, in parse_uri
nodes = _get_dns_srv_hosts(fqdn)
File “/Users/piyushjha/mflix-python/mflix_venv/lib/python3.6/site-packages/pymongo/uri_parser.py”, line 289, in _get_dns_srv_hosts
raise ConfigurationError(str(exc))
pymongo.errors.ConfigurationError: None of DNS query names exist: _mongodb._tcp.., _mongodb._tcp..local.
127.0.0.1 - - [19/Jun/2019 23:16:38] “GET /manifest.json HTTP/1.1” 200 -
127.0.0.1 - - [19/Jun/2019 23:16:38] “GET /favicon.ico HTTP/1.1” 200 -

Can you share your config file? It looks like something is misconfigured.

Hi @mail2piyushjha,

Please check your MFLIX_DB_URI in your config file. Make sure there are no double quotes.

If you are still facing the issue, please share the config file here.

Kanika

Please find below the config

Ticket: Connection

Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

Do not surround the URI with quotes

[PROD]

SECRET_KEY = super_secret_key_you_should_change

MFLIX_DB_URI = mongodb+srv://m220student:@

[TEST]

SECRET_KEY = super_secret_testing_key

MFLIX_DB_URI = mongodb+srv://m220student:@mflix-bqakp.mongodb.net/test?retryWrites=true&w=majority

Ticket: Connection

Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

Do not surround the URI with quotes

[PROD]
SECRET_KEY = super_secret_key_you_should_change
MFLIX_DB_URI = mongodb+srv://m220student:@

[TEST]
SECRET_KEY = super_secret_testing_key
MFLIX_DB_URI = mongodb+srv://m220student:@mflix-bqakp.mongodb.net/test?retryWrites=true&w=majority

For prod you are missing most of the uri.

For tet you are missing the password.

1 Like

Hi @mail2piyushjha,

Please make sure your connection string is complete.
Also, make sure you are adding your password as well like below.

   MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-bqakp.mongodb.net/test?retryWrites=true&w=majority

Kanika