Failing to connect to MySQL server

Issue Summary

I have reinstalled redash in a new docker container and with the new version I’m unable to get redash to connect to the MySQL database.
If I run mysql --host 172.22.0.3 --port 3304 -u root -p inside the worker or server container I’m able to connect just fine.
Using the same connection information in a data source and clicking on test connecting just prompts me with “Connection Test Failed:” without any helpful information.

The log on debug level only shows the following during test connection:

postgres_1   | LOG:  unexpected EOF on client connection with an open transaction
server_1     | [2020-07-10 01:58:32,432][PID:9][INFO][metrics] method=POST path=/api/data_sources/3/test endpoint=datasourcetestresource status=200 content_type=application/json content_length=28 duration=1009.60 query_count=4 query_duration=6.94
nginx_1      | <redacted> - - [10/Jul/2020:01:58:32 +0000] "POST /api/data_sources/3/test HTTP/1.1" 200 57 "http://redash.example.com:83/data_sources/3" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.119 Safari/537.36" "-

Technical details:

  • Redash Version: 9.0.0 - latest master
  • Browser/OS: Vivaldi - 3.1.1929.45
  • How did you install Redash: docker-compose

Sometimes the connection test fails but queries still work. Can you run a query against this data source?

I’m getting this error trying to run a query:

worker_1     | [2020-07-10 12:48:18,747][PID:1299][DEBUG][metrics] table=data_sources query=select duration=1.69
worker_1     | [2020-07-10 12:48:18,752][PID:1299][ERROR][rq.worker] cryptography.fernet.InvalidToken
worker_1     | Traceback (most recent call last):
worker_1     |   File "/usr/local/lib/python3.7/site-packages/cryptography/fernet.py", line 104, in _verify_signature
worker_1     |     h.verify(data[-32:])
worker_1     |   File "/usr/local/lib/python3.7/site-packages/cryptography/hazmat/primitives/hmac.py", line 66, in verify
worker_1     |     ctx.verify(signature)
worker_1     |   File "/usr/local/lib/python3.7/site-packages/cryptography/hazmat/backends/openssl/hmac.py", line 74, in verify
worker_1     |     raise InvalidSignature("Signature did not match digest.")
worker_1     | cryptography.exceptions.InvalidSignature: Signature did not match digest.
worker_1     |
worker_1     | During handling of the above exception, another exception occurred:
worker_1     |
worker_1     | Traceback (most recent call last):
worker_1     |   File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 822, in perform_job
worker_1     |     rv = job.perform()
worker_1     |   File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 605, in perform
worker_1     |     self._result = self._execute()
worker_1     |   File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 611, in _execute
worker_1     |     return self.func(*self.args, **self.kwargs)

When you reinstalled Redash did you use the same secret key?

I just checked, yes I did. I assume I will have to reinstall it again with a new key?

I reinstalled it with a different REDASH_COOKIE_SECRET but I’m still getting the same error.

Found the issue, REDASH_COOKIE_SECRET was only set for server but also needs to be set for the worker container.

1 Like