Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrading from ver. 0.37.2 to ver. 1.2.0 I get error: Unexpected error: SupersetApiError: Not authorized #15626

Closed
envicon opened this issue Jul 9, 2021 · 14 comments
Labels
question & help wanted Use Github discussions instead

Comments

@envicon
Copy link

envicon commented Jul 9, 2021

Hi

I hope someone can help me to get my Apache Superset running again.

I have upgraded to Superset ver. 1.2.0

First I get the error that the field dashboards.uuid was missing.

I created manually the field with phpMyAdmin with field type binary and length =16

I then created values with this command

UPDATE dashboards SET uuid=uuid()

But now I get this error when I log in to superset and opens a dashboard

Unexpected error: SupersetApiError: Not authorized

The dashboard is public, so everyone should be authorized to see it.
See error on screenshoots:

image

Can anyone help to solve this issue?

Thank you

Environment

  • superset version: 1.2.0
  • python version: 3.7.2
  • node.js version: 10.16.3

I have searched a long time for a solution, but haven't found any similar problem.

@envicon envicon added the #bug Bug report label Jul 9, 2021
@junlincc junlincc added question & help wanted Use Github discussions instead and removed #bug Bug report labels Jul 9, 2021
@nytai
Copy link
Member

nytai commented Jul 10, 2021

have you run all the commands required after upgrading?

superset db upgrade
superset init

Are there any errors and stack trances from the backend logs?

@envicon
Copy link
Author

envicon commented Jul 10, 2021

Hi
Thank you for your reply.

Yes I have run these commands several times.

pip install apache-superset --upgrade
superset db upgrade
superset init

When I start apache I get this info on the server. Is there another way to see logs?

: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
Loaded your LOCAL configuration at [/root/.superset/superset_config.py]
logging was configured successfully
2021-07-10 12:20:33,802:INFO:superset.utils.logging_configurator:logging was configured successfully
2021-07-10 12:20:33,819:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
/superset/lib/python3.7/site-packages/flask_caching/__init__.py:202: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
Loaded your LOCAL configuration at [/root/.superset/superset_config.py]
logging was configured successfully
2021-07-10 12:20:33,908:INFO:superset.utils.logging_configurator:logging was configured successfully
2021-07-10 12:20:33,924:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
/superset/lib/python3.7/site-packages/flask_caching/__init__.py:202: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
Loaded your LOCAL configuration at [/root/.superset/superset_config.py]
logging was configured successfully
2021-07-10 12:20:34,115:INFO:superset.utils.logging_configurator:logging was configured successfully
2021-07-10 12:20:34,132:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
/superset/lib/python3.7/site-packages/flask_caching/__init__.py:202: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
[2021-07-10 12:20:39 +0200] [23370] [INFO] Handling signal: winch

I think maybe it has to to with how I have created uuid-fields. I also found out that I missed the field in table dbs

Can I find a code how to create these fields?

Thanks

Best regards,
Bjarne

@envicon
Copy link
Author

envicon commented Jul 10, 2021

Hi again

I can add that when I try to open a dashboard which gives this error

Unexpected error: SupersetApiError: Not authorized

I get this information in the backend log:

  File "/superset/lib/python3.7/site-packages/gunicorn/instrument/statsd.py", line 127, in _sock_send
    self.sock.send(msg)
ConnectionRefusedError: [Errno 111] Connection refused

So I have not access to any of my dashboards

Any ideas to solve this?

@envicon
Copy link
Author

envicon commented Jul 10, 2021

Hi

I have searched a lot more for a solution and I guess the issue has something to do with the missing uuid fields.
I don't think that I have created it correctly

According to this fix: #13216

I should be able to downgrade db with this command:

Superset db downgrade 070c043f2fdb

It should delete uuid fields. It doesn't for me. I deleted the field manually.

I then upgraded the db again

Superset db upgrade
Superset init

Unfortunately it did not create uuid-fields in my MySQL-tables.

According to this issue #13033 I should have uuid-fields created in several other tables than dbs and dashboards

Adding uuids for dbs...

Adding uuids for dashboards...

Adding uuids for slices...

Adding uuids for tables...

Adding uuids for table_columns...

Adding uuids for sql_metrics...

Adding uuids for dashboard_email_schedules...

Adding uuids for slice_email_schedules...

How do I get this?

I hope somebody can help me

Thank you

@nytai
Copy link
Member

nytai commented Jul 12, 2021

The statsd error log doesn't seem related this this. I'm not sure what the missing uuid fields would result in not authorized error, it may be caused by something else. Do you have any logs related to the db upgrade command? It seems that with changes in #13216 the upgrade command should fail loudly if the uuid columns were not added by the migration.

As a last resort you could try bringing up 1.2 against a new database and then import your datasets/dashboards/charts/etc into the newly installed version.

@zufolo441
Copy link

As a last resort you could try bringing up 1.2 against a new database and then import your datasets/dashboards/charts/etc into the newly installed version.

How could I do this ?

@envicon
Copy link
Author

envicon commented Jul 13, 2021

Hi

I bought a new VPS and installed Superset ver. 1.2.0 from scratch. I also connected to a mysql-database. It is now working but empty from data. How do I import my datasets/dashboards from my existing server?

Best regards,
Bjarne

@nytai
Copy link
Member

nytai commented Jul 13, 2021

Superset has an export feature for each of the objects, otherwise you could do a sql dump for each of the tables.

@nytai
Copy link
Member

nytai commented Jul 13, 2021

Version 0.38 might be missing exports on some of the objects (database and datasets I think), so the sql dump might be necessary

@envicon
Copy link
Author

envicon commented Jul 13, 2021

Hi nytai

Thank you for your reply.

I can easily get all data imported with a SQLdump, but how do I solve that some tables don't have uuids fields.

Is there SQL-job which can add them? Is it possible to find in the upgrade files?

Best regards,
Bjarne

@envicon
Copy link
Author

envicon commented Jul 14, 2021

Hi

I have now imported all data to my new VPS.
I have created all uid fields and changed the values with this job

UPDATE dbs SET uuid = UNHEX(REPLACE(uuid(), "-", ""));
UPDATE slices SET uuid = UNHEX(REPLACE(uuid(), "-", ""));
UPDATE tables SET uuid = UNHEX(REPLACE(uuid(), "-", ""));
UPDATE table_columns SET uuid = UNHEX(REPLACE(uuid(), "-", ""));
UPDATE sql_metrics SET uuid = UNHEX(REPLACE(uuid(), "-", ""));
UPDATE dashboard_email_schedules SET uuid = UNHEX(REPLACE(uuid(), "-", ""));
UPDATE slice_email_schedules SET uuid = UNHEX(REPLACE(uuid(), "-", ""));

I get the exact same error, so it must be in my data

Unexpected error: SupersetApiError: Not authorized

An error occurred while fetching query info: Not authorized
An error occurred while fetching dashboard info: Not authorized
There was an issues fetching your dashboards: [object Response]
There was an issues fetching your chart: [object Response]
There was an issues fetching your saved queries: [object Response]

How can I solve this?

Thanks

@envicon
Copy link
Author

envicon commented Jul 14, 2021

Hi,

I solved the issue.
It was the tables below which was completely wrong after update. I found out by comparing a new Superset installation
ab_permission_view
ab_permission
ab_view_menu
ab_permission_view_role

By copying this tables from the new installation to my old installation I got it to work again.

I also found a lot of tables which missed fields - mostly uuid but also other fields and some tables.

I anyone are interested in the exact changes I can write them here

Best regards,
Bjarne

@nytai
Copy link
Member

nytai commented Jul 14, 2021

Yea normally these db schema changes are applied via superset db upgrade, I'm glad you figured it out and were able to apply these schema changes manually -- you clearly know your SQL!

@envicon
Copy link
Author

envicon commented Jul 14, 2021

Thank you, nytai. Yes it is strange that my database it not updated with this command and that I don't get error messages. I have experienced this before.

After many hours of searching and trying I feel like an expert on this issue :-)

@apache apache locked and limited conversation to collaborators Feb 2, 2022
@geido geido converted this issue into discussion #18312 Feb 2, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question & help wanted Use Github discussions instead
Projects
None yet
Development

No branches or pull requests

4 participants