question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Elasticsearch connection got problem when click test connection

See original GitHub issue

A clear and concise description of what the bug is.

Expected results

what you expected to happen. elasticsearch+http://elastic:changeme@device1:9200 I added the above url as the ES connection

Actual results

But it failed with an Error:

ERROR: {"error": "Connection failed!\n\nThe error message returned was:\ncan only concatenate str (not \"NoneType\") to str", "stacktrace": "Traceback (most recent call last):\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/superset/views/core.py\", line 1704, in testconn\n    with closing(engine.connect()) as conn:\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py\", line 2206, in connect\n    return self._connection_cls(self, **kwargs)\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py\", line 103, in __init__\n    else engine.raw_connection()\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py\", line 2306, in raw_connection\n    self.pool.unique_connection, _connection\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py\", line 2275, in _wrap_pool_connect\n    return fn()\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py\", line 303, in unique_connection\n    return _ConnectionFairy._checkout(self)\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py\", line 760, in _checkout\n    fairy = _ConnectionRecord.checkout(pool)\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py\", line 492, in checkout\n    rec = pool._do_get()\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/impl.py\", line 238, in _do_get\n    return self._create_connection()\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py\", line 308, in _create_connection\n    return _ConnectionRecord(self)\n  File \"/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/...

This is the log:

TypeError: can only concatenate str (not "NoneType") to str
2020-01-04 18:44:27,311:INFO:werkzeug:127.0.0.1 - - [04/Jan/2020 18:44:27] "POST /superset/testconn HTTP/1.1" 500 -
2020-01-04 18:48:03,388:INFO:root:Database.get_sqla_engine(). Masked URL: elasticsearch+http://elastic:XXXXXXXXXX@device1:9200
2020-01-04 18:48:03,389:ERROR:root:can only concatenate str (not "NoneType") to str
Traceback (most recent call last):
  File "/data/software/miniconda3/lib/python3.7/site-packages/superset/views/core.py", line 1704, in testconn
    with closing(engine.connect()) as conn:
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2206, in connect
    return self._connection_cls(self, **kwargs)
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 103, in __init__
    else engine.raw_connection()
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2306, in raw_connection
    self.pool.unique_connection, _connection
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2275, in _wrap_pool_connect
    return fn()
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 303, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 760, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 492, in checkout
    rec = pool._do_get()
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 238, in _do_get
    return self._create_connection()
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection
    return _ConnectionRecord(self)
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 437, in __init__
    self.__connect(first_connect_check=True)
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 639, in __connect
    connection = pool._invoke_creator(self)
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
    return dialect.connect(*cargs, **cparams)
  File "/data/software/miniconda3/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 453, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/data/software/miniconda3/lib/python3.7/site-packages/es/elastic/api.py", line 32, in connect
    return Connection(host, port, path, scheme, user, password, context, **kwargs)
  File "/data/software/miniconda3/lib/python3.7/site-packages/es/elastic/api.py", line 109, in __init__
    **kwargs,
  File "/data/software/miniconda3/lib/python3.7/site-packages/es/baseapi.py", line 57, in __init__
    self.url = parse.urlunparse((scheme, netloc, path, None, None, None))
  File "/data/software/miniconda3/lib/python3.7/urllib/parse.py", line 475, in urlunparse
    return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment)))
  File "/data/software/miniconda3/lib/python3.7/urllib/parse.py", line 487, in urlunsplit
    url = '//' + (netloc or '') + url
TypeError: can only concatenate str (not "NoneType") to str

what actually happens.

Screenshots

If applicable, add screenshots to help explain your problem.

How to reproduce the bug

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

Environment

(please complete the following information):

  • superset version: superset version Superset 0.35.1
  • python version: python --version Python 3.7.3
  • node.js version: node -v
  • npm version: npm -v

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

I already installed pip install elasticsearch-dbapi

Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dpgasparcommented, Jan 4, 2020

Please try with the following connection string instead:

elasticsearch+http://elastic:changeme@device1:9200/

Notice the trailing slash, I’ll improve this on elasticsearch-dbapi

0reactions
dpgasparcommented, Jan 7, 2020

no problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elasticsearch connection got problem when click test connection
A clear and concise description of what the bug is. Expected results what you expected to happen.
Read more >
Troubleshooting Connection Issues for Elasticsearch
Stacktrace #1 - Connection Refused​​ Elasticsearch was not started. This is due to the fact that Bitbucket Server started before Elasticsearch on ...
Read more >
Test elasticsearch connection in Python - Stack Overflow
When Elasticsearch is running, there is no problem with ping. The problem is when ES is not running, ping() is returning FALSE after...
Read more >
Fix common cluster issues | Elasticsearch Guide [8.5] | Elastic
There are multiple reasons why shards might get unassigned, ranging from misconfigured allocation settings to lack of disk space. Troubleshooting an unstable ...
Read more >
Magento 2.4.0 - Getting Error Could not validate a connection ...
The issue is the ElasticSearch config in your command. To start the verification, you can run this curl ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found