apache / apache/superset

Failed to add user to db session: Class 'werkzeug.local.LocalProxy' is not mapped

Open
#41,268 3 comments 0 reactions 0 assignees View on GitHub
authentication:access-control embedded validation:required
Dominant language
Python
Stars
74.8k
Forks
18.3k
Avg merge
2d 5h
Merged PRs (30d)
685

Description

### Bug description

Recently, I have upgraded apache superset from 5.0.0 -> 6.1.0 and embedding sdk from 0.1.3 to 0.3.0

I am using docker based setup and once upgraded, I have executed following command.

`superset db upgrade`

I have some dashboards embedded on Laravel based admin panel. General embedding functionality seems to work.

1. Embedding
2. Drilling
3. Export, Download

But, When I click view as table, table is not loaded.

Image

Image

Permissions added for embedding role:

1. all datasource acess
2. can csv Superset
3. can drill Dashboard
4. can explore json Superset
5. can export Chart
6. can get Datasource
7. can get drill info Dataset
8. can grant guest token SecurityGuestApi
9. can log Superset
10. can read Chart
11. can read Dataset
12. can read Dashboard
13. can read Database
14. can write Chart
15. can read CurrentUserRestApi
16. can samples Datasource
17. can time range Api
18. can view chart as table Dashboard
19. can write ExploreFormDataRestApi

This problem is on only embedding view. When logged in as user with admin role on superset instance it's loading correctly.

Image

**Log:**

```sh
superset-1 | 2026-06-22 04:52:34,299:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://pokemon:XXXXXXXXXX@db:5432/report
superset-1 | 2026-06-22 04:52:34,311:DEBUG:superset.common.query_object:QueryObject CACHE KEY generated: 9258184b25b1c56f0b23e5b0fb96ced0c1c5a41fb2da27ba6da6e3e876826c0e from dict with keys: ['changed_on', 'columns', 'datasource', 'extra_cache_keys', 'extras', 'filter', 'granularity', 'group_others_when_limit_reached', 'inner_from_dttm', 'inner_to_dttm', 'is_rowcount', 'is_timeseries', 'metrics', 'order_desc', 'orderby', 'post_processing', 'result_type', 'rls', 'row_limit', 'row_offset', 'series_columns', 'series_limit', 'series_limit_metric', 'time_range', 'time_shift']
superset-1 | 2026-06-22 04:52:34,312:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://pokemon:XXXXXXXXXX@db:5432/report
superset-1 | 2026-06-22 04:52:34,315:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://pokemon:XXXXXXXXXX@db:5432/report
superset-1 | 2026-06-22 04:52:34,327:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://pokemon:XXXXXXXXXX@db:5432/report
superset-1 | 2026-06-22 04:52:34,329:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://pokemon:XXXXXXXXXX@db:5432/report
superset-1 | 2026-06-22 04:52:34,330:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://pokemon:XXXXXXXXXX@db:5432/report
superset-1 | 2026-06-22 04:52:34,343:WARNING:root:Failed to add user to db session: Class 'werkzeug.local.LocalProxy' is not mapped
superset-1 | 2026-06-22 04:52:34,344:DEBUG:superset.stats_logger:[stats_logger] (incr) execute_sql
superset-1 | 2026-06-22 04:52:34,350:WARNING:root:Failed to add user to db session: Class 'werkzeug.local.LocalProxy' is not mapped
superset-1 | 2026-06-22 04:52:34,350:DEBUG:superset.stats_logger:[stats_logger] (incr) load_into_dataframe
superset-1 | 2026-06-22 04:52:34,356:DEBUG:superset.common.query_object:post_processing:
superset-1 | [{'operation': 'contribution',
superset-1 | 'options': {'columns': ['COUNT(id)'],
superset-1 | 'rename_columns': ['COUNT(id)__contribution']}}]
superset-1 | 2026-06-22 04:52:34,357:WARNING:root:Failed to add user to db session: Class 'werkzeug.local.LocalProxy' is not mapped
superset-1 | 2026-06-22 04:52:34,358:DEBUG:superset.stats_logger:[stats_logger] (incr) QueryObject.post_processing
superset-1 | 2026-06-22 04:52:34,366:DEBUG:superset.stats_logger:[stats_logger] (incr) loaded_from_source
superset-1 | 2026-06-22 04:52:34,366:DEBUG:superset.stats_logger:[stats_logger] (incr) loaded_from_source_without_force
superset-1 | 2026-06-22 04:52:34,369:WARNING:root:Failed to add user to db session: Class 'werkzeug.local.LocalProxy' is not mapped
superset-1 | 2026-06-22 04:52:34,369:DEBUG:superset.stats_logger:[stats_logger] (incr) ChartDataRestApi.json_dumps
superset-1 | 2026-06-22 04:52:34,372:WARNING:root:Failed to add user to db session: Class 'werkzeug.local.LocalProxy' is not mapped
superset-1 | 2026-06-22 04:52:34,372:DEBUG:superset.stats_logger:[stats_logger] (incr) _get_data_response
superset-1 | 2026-06-22 04:52:34,376:WARNING:root:Failed to add user to db session: Class 'werkzeug.local.LocalProxy' is not mapped
superset-1 | 2026-06-22 04:52:34,379:DEBUG:superset.stats_logger:[stats_logger] (incr) ChartDataRestApi.data.success
superset-1 | 2026-06-22 04:52:34,379:DEBUG:superset.stats_logger:[stats_logger] (timing) ChartDataRestApi.data.time | 99.80581799982247
superset-1 | 172.18.0.1 - - [22/Jun/2026:04:52:34 +0000] "POST /api/v1/chart/data?form_data=%7B%22slice_id%22%3A27%7D HTTP/1.1" 200 213 "http://localhost:8088/embedded/5f53418e-720b-4b6b-a166-e6daaba23128?uiConfig=1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36"
```

I did not see any error on the console or network.

I am not sure what I am missing here. It was working correctly on previous setup ( superset 5.0.0 and sdk 0.3.1)

Any relavant information would be really helpful as i am stuck on this from some days.

### Screenshots/recordings

_No response_

### Superset version

6.1.0

### Python version

3.10

### Node version

18 or greater

### Browser

Chrome

### Additional context

Similar issues which didn't solve my problem:

https://github.com/apache/superset/issues/29403

https://github.com/apache/superset/discussions/26083

### Checklist

- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the embedded “view as table” flow after running `superset db upgrade`, using the `/api/v1/chart/data` request and the logged `LocalProxy` mapping warning as entry points. Done means the embedded table view loads without the warning, while the existing admin-role behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, laravel, postgresql, python
Domain
api, authentication, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.