apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.29k stars 13.67k forks source link

Unable to save database when impersonation is enabled #14377

Closed octonary closed 5 months ago

octonary commented 3 years ago

I am getting the following error when I try to enable impersonation for a Presto database...

An error occurred while fetching databases: "Connection failed, please check your connection settings"

Impersonation was previously working before authentication was added to the Presto UI. I found a few other issues related to impersonation but they all appear to be closed or merged so I upgraded to the latest apache-superset version in hopes that these issues were all resolved. I am able to successfully add a database connection if the service account is using the same credentials as the currently logged in user so I thought this may be a similar issue to #7170. However, that issue yielded a 401 response whereas this issue clearly returns a 200 from Presto but then fails when trying to save the details to the superset metadata db.

I am able to successfully add a database connection when impersonation is not enabled. I am also able to successfully test the connection with impersonation enabled but when I try and save I get the error. The logs just show a 422 response...

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): presto_host:8443
DEBUG:urllib3.connectionpool:https://presto_host:8443 "POST /v1/statement HTTP/1.1" 200 606
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): presto_host:8443
DEBUG:urllib3.connectionpool:https://presto_host:8443 "GET /v1/statement/queued/20210427_160205_00092_pvzh9/ya51b2c3a79a6fd2fb82589fdb1a4a5be888e1571/1 HTTP/1.1" 200 806
DEBUG:superset.stats_logger:[stats_logger] (incr) DatabaseRestApi.put.error
DEBUG:superset.stats_logger:[stats_logger] (timing) DatabaseRestApi.put.time | 98.71059656143188 
INFO:werkzeug:10.90.0.229 - - [27/Apr/2021 10:02:05] "PUT /api/v1/database/3 HTTP/1.1" 422 -

How to reproduce the bug:

  1. Login to superset UI
  2. Add a new database or modify an existing one
  3. Check the "Impersonate Logged In User (Presto & Hive)" checkbox found in the EXTRA tab
  4. Click the SAVE button
  5. See the "Connection failed, please check your connection settings" error pop-up on the bottom right of the page

Environment:

octonary commented 3 years ago

Just following up to see if anyone else has ran into this and knows of a fix or workaround.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

umsalotagi commented 2 years ago

@octonary Add user to superset with same username and password that will work on database. So superset username and password should be same as database user and password. Once you done that login to superset with this superset user. You should be able to save database connection when impersonation enabled. This is more like bypass.

NickLarsenNZ commented 10 months ago

There should be a way to force a connection to save. Especially since you can import a Connection which doesn't work without impersonation (import doesn't allow setting impersonation, see https://github.com/apache/superset/pull/14718).

rusackas commented 5 months ago

Closing this since it was reported on Superset 1.x, and we now only support Superset 3.1/4.0. If you're still facing this issue as described, let us know and we can re-open, but this sounds more like a feature request than a bug if I'm interpreting correctly :)