Skip to content

Permalinks doesn't work: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte #28565

Closed as not planned
@sensorsasha

Description

@sensorsasha

Bug description

We're running superset using docker-compose-non-dev.yml. All users are admins. When a user tries to create a permalink to a dashboard it doesn't work.

How to reproduce the bug

  1. Create a dashboard.
  2. Click on "Copy permalink to clipboard".
  3. You get "sorry, something went wrong" error.

Request from the dev tools
POST myhostname.com/api/v1/dashboard/63/permalink

Body:

{"urlParams":[],"dataMask":{"437":{"id":"437","extraFormData":{},"filterState":{},"ownState":{}},"NATIVE_FILTER-JD6CVYqbS":{"id":"NATIVE_FILTER-JD6CVYqbS","extraFormData":{"time_range":"DATEADD(DATETIME(\"2024-05-16T00:00:00\"), -7, day) : 2024-05-16T00:00:00"},"filterState":{"value":"DATEADD(DATETIME(\"2024-05-16T00:00:00\"), -7, day) : 2024-05-16T00:00:00"},"ownState":{}},"NATIVE_FILTER-c-dcmnbdQ":{"id":"NATIVE_FILTER-c-dcmnbdQ","extraFormData":{},"filterState":{},"ownState":{}},"NATIVE_FILTER-B8llqgi_O":{"id":"NATIVE_FILTER-B8llqgi_O","extraFormData":{},"filterState":{},"ownState":{}}},"activeTabs":[]}

Error in the superset_app container logs

2024-05-16 16:22:10,540:ERROR:flask_appbuilder.api:'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/flask_appbuilder/api/__init__.py", line 110, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/utils/log.py", line 255, in wrapper
    value = f(*args, **kwargs)
  File "/app/superset/views/base_api.py", line 93, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/dashboards/permalink/api.py", line 97, in post
    key = CreateDashboardPermalinkCommand(
  File "/app/superset/commands/dashboard/permalink/create.py", line 60, in run
    key=get_deterministic_uuid(self.salt, (user_id, value)),
  File "/app/superset/commands/dashboard/permalink/base.py", line 35, in salt
    return get_permalink_salt(SharedKey.DASHBOARD_PERMALINK_SALT)
  File "/app/superset/key_value/shared_entries.py", line 51, in get_permalink_salt
    salt = get_shared_value(key)
  File "/app/superset/key_value/shared_entries.py", line 34, in get_shared_value
    return GetKeyValueCommand(RESOURCE, key=uuid_key, codec=CODEC).run()
  File "/app/superset/commands/key_value/get.py", line 60, in run
    return self.get()
  File "/app/superset/commands/key_value/get.py", line 71, in get
    return self.codec.decode(entry.value)
  File "/app/superset/key_value/types.py", line 78, in decode
    return json.loads(value)
  File "/usr/local/lib/python3.9/json/__init__.py", line 341, in loads
    s = s.decode(detect_encoding(s), 'surrogatepass')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
77.54.193.217 - - [16/May/2024:16:22:10 +0000] "POST /api/v1/dashboard/60/permalink HTTP/1.1" 500 26 "https://myhostname.com/superset/dashboard/consumer-intel-cohorts-modules-enabled/?native_filters_key=h4REjeqI3GSg8oqqmM5ULv-u6A7s9J6nfcP86wALNu1ZiXu5UgpFOxpv7pJ19heI" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"

Screenshots/recordings

Screenshot 2024-05-17 at 15 27 17
Screenshot 2024-05-17 at 15 27 25

Superset version

3.1.3

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dashboardNamespace | Anything related to the Dashboard

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions