Crash on 'edr report' command (http 104 error)
Describe the bug Hello I am facing a blocking bug to generate my html report : Cant generate it with OSS elementary (inside a gitlab runner from CI/CD) with CLI 'edr report' but everything working in local. Looks like there is an unwilling 104 http error .
We are running it from a setted network where databases are well accessible (but not outside of intranet).
Asking myself if maybe the OSS package could connect to outside and in that way block our usage of elementary ? (like an anonymous usage token maybe).
Thanks
To Reproduce Steps to reproduce the behavior:
- dbt seed --select data -t $ENV_BRANCH
- dbt test --exclude tag:unit_tests -t $ENV_BRANCH
- dbt run --select elementary -t $ENV_BRANCH
- dbt run-operation elementary.generate_elementary_cli_profile
- edr report
- bug appear (see logs below)
Expected behavior I shoudnt have a 104 http error but instead I am looking for my edr_target to be generated with a html result.
Screenshots Rather than screenshot I copy the logs generated by this bug.
$ edr report
________ __
/ ____/ /__ ____ ___ ___ ____ / /_____ ________ __
/ __/ / / _ \/ __ `__ \/ _ \/ __ \/ __/ __ `/ ___/ / / /
/ /___/ / __/ / / / / / __/ / / / /_/ /_/ / / / /_/ /
/_____/_/\___/_/ /_/ /_/\___/_/ /_/\__/\__,_/_/ \__, /
/____/
Any feedback and suggestions are welcomed! join our community here - https://bit.ly/slack-elementary
2024-11-06 06:52:57 — INFO — Running with edr=0.16.1
2024-11-06 06:52:57 — INFO — Installing packages for edr internal dbt package...
2024-11-06 06:52:57 — INFO — Running dbt command --log-format json deps --project-dir /usr/local/lib/python3.9/site-packages/elementary/monitor/dbt_project --profiles-dir /builds/soi-data/schref-patching/src/dbt/schref01_correction
{"data": {"exc": "External connection exception occurred: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))"}, "info": {"category": "", "code": "Z002", "extra": {}, "invocation_id": "b9a2f598-8208-490d-84b1-eeb88e6926cd", "level": "error", "msg": "Encountered an error:\nExternal connection exception occurred: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))", "name": "MainEncounteredError", "pid": 175, "thread": "MainThread", "ts": "2024-11-06T06:53:02.672315Z"}}
{"data": {"stack_trace": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py\", line 716, in urlopen\n httplib_response = self._make_request(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py\", line 404, in _make_request\n self._validate_conn(conn)\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py\", line 1061, in _validate_conn\n conn.connect()\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connection.py\", line 419, in connect\n self.sock = ssl_wrap_socket(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py\", line 458, in ssl_wrap_socket\n ssl_sock = _ssl_wrap_socket_impl(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py\", line 502, in _ssl_wrap_socket_impl\n return ssl_context.wrap_socket(sock, server_hostname=server_hostname)\n File \"/usr/local/lib/python3.9/ssl.py\", line 501, in wrap_socket\n return self.sslsocket_class._create(\n File \"/usr/local/lib/python3.9/ssl.py\", line 1041, in _create\n self.do_handshake()\n File \"/usr/local/lib/python3.9/ssl.py\", line 1310, in do_handshake\n self._sslobj.do_handshake()\nConnectionResetError: [Errno 104] Connection reset by peer\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/requests/adapters.py\", line 667, in send\n resp = conn.urlopen(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py\", line 802, in urlopen\n retries = retries.increment(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py\", line 552, in increment\n raise six.reraise(type(error), error, _stacktrace)\n File \"/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py\", line 769, in reraise\n raise value.with_traceback(tb)\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py\", line 716, in urlopen\n httplib_response = self._make_request(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py\", line 404, in _make_request\n self._validate_conn(conn)\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py\", line 1061, in _validate_conn\n conn.connect()\n File \"/usr/local/lib/python3.9/site-packages/urllib3/connection.py\", line 419, in connect\n self.sock = ssl_wrap_socket(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py\", line 458, in ssl_wrap_socket\n ssl_sock = _ssl_wrap_socket_impl(\n File \"/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py\", line 502, in _ssl_wrap_socket_impl\n return ssl_context.wrap_socket(sock, server_hostname=server_hostname)\n File \"/usr/local/lib/python3.9/ssl.py\", line 501, in wrap_socket\n return self.sslsocket_class._create(\n File \"/usr/local/lib/python3.9/ssl.py\", line 1041, in _create\n self.do_handshake()
...........................
{{ HUGE STACK TRACE }}
...........................
site-packages/dbt/clients/registry.py\", line 187, in index\n return connection_exception_retry(get_index_fn, 5)\n File \"/usr/local/lib/python3.9/site-packages/dbt_common/utils/connection.py\", line 34, in connection_exception_retry\n return connection_exception_retry(fn, max_attempts, attempt + 1)\n File \"/usr/local/lib/python3.9/site-packages/dbt_common/utils/connection.py\", line 34, in connection_exception_retry\n return connection_exception_retry(fn, max_attempts, attempt + 1)\n File \"/usr/local/lib/python3.9/site-packages/dbt_common/utils/connection.py\", line 34, in connection_exception_retry\n return connection_exception_retry(fn, max_attempts, attempt + 1)\n [Previous line repeated 2 more times]\n File \"/usr/local/lib/python3.9/site-packages/dbt_common/utils/connection.py\", line 36, in connection_exception_retry\n raise ConnectionError(\"External connection exception occurred: \" + str(exc))\ndbt_common.exceptions.connection.ConnectionError: External connection exception occurred: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))\n", "name": "MainStackTrace", "pid": 175, "thread": "MainThread", "ts": "2024-11-06T06:53:02.679819Z"}}
Traceback (most recent call last):
File "/usr/local/bin/edr", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/elementary/cli/cli.py", line 67, in invoke
return super().invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/elementary/monitor/cli.py", line 442, in report
data_monitoring = DataMonitoringReport(
File "/usr/local/lib/python3.9/site-packages/elementary/monitor/data_monitoring/report/data_monitoring_report.py", line 40, in __init__
super().__init__(
File "/usr/local/lib/python3.9/site-packages/elementary/monitor/data_monitoring/data_monitoring.py", line 35, in __init__
self.internal_dbt_runner = self._init_internal_dbt_runner()
File "/usr/local/lib/python3.9/site-packages/elementary/monitor/data_monitoring/data_monitoring.py", line 61, in _init_internal_dbt_runner
internal_dbt_runner = create_dbt_runner(
File "/usr/local/lib/python3.9/site-packages/elementary/clients/dbt/factory.py", line 37, in create_dbt_runner
return RUNNER_CLASS(
File "/usr/local/lib/python3.9/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 57, in __init__
self._run_deps_if_needed()
File "/usr/local/lib/python3.9/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 320, in _run_deps_if_needed
self.deps()
File "/usr/local/lib/python3.9/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 133, in deps
result = self._run_command(
File "/usr/local/lib/python3.9/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 114, in _run_command
result = self._inner_run_command(
File "/usr/local/lib/python3.9/site-packages/elementary/clients/dbt/api_dbt_runner.py", line 53, in _inner_run_command
raise DbtCommandError(
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command.
External connection exception occurred: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Environment (please complete the following information): Name: elementary-data Version: 0.16.1
- Elementary CLI (edr) version: [0.16.1]
- Elementary dbt package version: [0.16.1]
- dbt version: [e.g. 1.8.2]
- Data warehouse: [self hosted dataWarehouse]
- Infrastructure details: working with postgres on a linux self-hosted server inside a gitlab-runner for CI/CD
Additional context It works as desired on my local computer (including requesting db). I can also confirm databases is reached inside the gitlab-runner
Would you be willing to contribute a fix for this issue? If needed yes but will need guidance
By the way I have tried to put "anonymous_usage_tracking: False" in a config file but since it is runned by root user and instead of simply put config file in ~/.edr/ I had to do this command : edr report -c /absolute/path/to/config.yml but have same error (104 http crash)...