Bug description
I deploy my Superset instance using Docker image and Helm When the service is up, I can not login using admin/admin account So I search on document and found out that I need to create admin account using superset fab command But that command failed to execute, error log provided below I also tried other superset command, but nothing is executable, all return the same error
How to reproduce the bug
- Build a Superset image using Dockerfile
- Deploy using Helm
- Create admin account using "superset fab create-admin"
- Encounter error
Screenshots/recordings
root@superset-564cfd87c4-mkcqq:/app# superset superset fab create-admin
Loaded your LOCAL configuration at [/app/pythonpath/superset_config.py]
logging was configured successfully
2024-05-29 09:48:52,198:INFO:superset.utils.logging_configurator:logging was configured successfully
2024-05-29 09:48:52,204:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
/usr/local/lib/python3.9/site-packages/flask_limiter/extension.py:293: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
warnings.warn(
logging was configured successfully
logging was configured successfully
2024-05-29 09:48:53,511:INFO:superset.utils.logging_configurator:logging was configured successfully
2024-05-29 09:48:53,512:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
/usr/local/lib/python3.9/site-packages/flask_limiter/extension.py:293: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
warnings.warn(
Failed to create app
Traceback (most recent call last):
File "/app/superset/app.py", line 40, in create_app
app_initializer.init_app()
File "/app/superset/initialization/__init__.py", line 512, in init_app
self.init_app_in_ctx()
File "/app/superset/initialization/__init__.py", line 438, in init_app_in_ctx
self.configure_fab()
File "/app/superset/initialization/__init__.py", line 562, in configure_fab
appbuilder.init_app(self.superset_app, db.session)
File "/app/custom-lib/flask_appbuilder/base.py", line 218, in init_app
self._add_admin_views()
File "/app/custom-lib/flask_appbuilder/base.py", line 325, in _add_admin_views
self.sm.register_views()
File "/app/custom-lib/flask_appbuilder/security/sqla/manager.py", line 95, in register_views
super(SecurityManager, self).register_views()
File "/app/custom-lib/flask_appbuilder/security/manager.py", line 737, in register_views
self.limiter.limit(self.auth_rate_limit, methods=["POST"])(
File "/usr/local/lib/python3.9/site-packages/flask_limiter/extension.py", line 1164, in call
name = get_qualified_name(obj)
File "/usr/local/lib/python3.9/site-packages/flask_limiter/util.py", line 32, in get_qualified_name
return f"{callable.module}.{callable.name}.{callable.qualname}"
AttributeError: 'NoneType' object has no attribute 'module'
Failed to create app
Traceback (most recent call last):
File "/app/superset/app.py", line 40, in create_app
app_initializer.init_app()
File "/app/superset/initialization/__init__.py", line 512, in init_app
self.init_app_in_ctx()
File "/app/superset/initialization/__init__.py", line 438, in init_app_in_ctx
self.configure_fab()
File "/app/superset/initialization/__init__.py", line 562, in configure_fab
appbuilder.init_app(self.superset_app, db.session)
File "/app/custom-lib/flask_appbuilder/base.py", line 218, in init_app
self._add_admin_views()
File "/app/custom-lib/flask_appbuilder/base.py", line 325, in _add_admin_views
self.sm.register_views()
File "/app/custom-lib/flask_appbuilder/security/sqla/manager.py", line 95, in register_views
super(SecurityManager, self).register_views()
File "/app/custom-lib/flask_appbuilder/security/manager.py", line 737, in register_views
self.limiter.limit(self.auth_rate_limit, methods=["POST"])(
File "/usr/local/lib/python3.9/site-packages/flask_limiter/extension.py", line 1164, in call
name = get_qualified_name(obj)
File "/usr/local/lib/python3.9/site-packages/flask_limiter/util.py", line 32, in get_qualified_name
return f"{callable.module}.{callable.name}.{callable.qualname}"
AttributeError: 'NoneType' object has no attribute 'module'
2024-05-29 09:48:53,550:ERROR:superset.app:Failed to create app
Traceback (most recent call last):
File "/app/superset/app.py", line 40, in create_app
app_initializer.init_app()
File "/app/superset/initialization/__init__.py", line 512, in init_app
self.init_app_in_ctx()
File "/app/superset/initialization/__init__.py", line 438, in init_app_in_ctx
self.configure_fab()
File "/app/superset/initialization/__init__.py", line 562, in configure_fab
appbuilder.init_app(self.superset_app, db.session)
File "/app/custom-lib/flask_appbuilder/base.py", line 218, in init_app
self._add_admin_views()
File "/app/custom-lib/flask_appbuilder/base.py", line 325, in _add_admin_views
self.sm.register_views()
File "/app/custom-lib/flask_appbuilder/security/sqla/manager.py", line 95, in register_views
super(SecurityManager, self).register_views()
File "/app/custom-lib/flask_appbuilder/security/manager.py", line 737, in register_views
self.limiter.limit(self.auth_rate_limit, methods=["POST"])(
File "/usr/local/lib/python3.9/site-packages/flask_limiter/extension.py", line 1164, in call
name = get_qualified_name(obj)
File "/usr/local/lib/python3.9/site-packages/flask_limiter/util.py", line 32, in get_qualified_name
return f"{callable.module}.{callable.name}.{callable.qualname}"
AttributeError: 'NoneType' object has no attribute 'module'
Traceback (most recent call last):
File "/usr/local/bin/superset", line 33, in <module>
sys.exit(load_entry_point('apache-superset', 'console_scripts', 'superset')())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1651, in invoke
cmd_name, cmd, args = self.resolve_command(ctx, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1698, in resolve_command
cmd = self.get_command(ctx, cmd_name)
File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 578, in get_command
app = info.load_app()
File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 308, in load_app
app = locate_app(import_name, name)
File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 237, in locate_app
return find_app_by_string(module, app_name)
File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 165, in find_app_by_string
app = attr(*args, **kwargs)
File "/app/superset/app.py", line 47, in create_app
raise ex
File "/app/superset/app.py", line 40, in create_app
app_initializer.init_app()
File "/app/superset/initialization/__init__.py", line 512, in init_app
self.init_app_in_ctx()
File "/app/superset/initialization/__init__.py", line 438, in init_app_in_ctx
self.configure_fab()
File "/app/superset/initialization/__init__.py", line 562, in configure_fab
appbuilder.init_app(self.superset_app, db.session)
File "/app/custom-lib/flask_appbuilder/base.py", line 218, in init_app
self._add_admin_views()
File "/app/custom-lib/flask_appbuilder/base.py", line 325, in _add_admin_views
self.sm.register_views()
File "/app/custom-lib/flask_appbuilder/security/sqla/manager.py", line 95, in register_views
super(SecurityManager, self).register_views()
File "/app/custom-lib/flask_appbuilder/security/manager.py", line 737, in register_views
self.limiter.limit(self.auth_rate_limit, methods=["POST"])(
File "/usr/local/lib/python3.9/site-packages/flask_limiter/extension.py", line 1164, in call
name = get_qualified_name(obj)
File "/usr/local/lib/python3.9/site-packages/flask_limiter/util.py", line 32, in get_qualified_name
return f"{callable.module}.{callable.name}.{callable.qualname}"
AttributeError: 'NoneType' object has no attribute 'module'
Superset version
3.1.3
Python version
3.9
Node version
I don't know
Browser
Chrome
Additional context
No response
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.
Comment From: dosubot[bot]
Hey there, @EuphoriaCelestial! I'm here to help you with your Superset issue. Let's get this sorted out together!
To resolve the issue where Superset commands fail to execute, specifically when trying to create an admin account using superset fab create-admin
, resulting in an AttributeError
, ensure that the SupersetAppInitializer
class is properly initialized and configured. The SupersetAppInitializer
class handles various initialization tasks, including setting up the Flask app, configuring Celery, and initializing views.
Here is a snippet of the SupersetAppInitializer
class that shows the initialization process:
class SupersetAppInitializer: # pylint: disable=too-many-public-methods
def __init__(self, app: SupersetApp) -> None:
super().__init__()
self.superset_app = app
self.config = app.config
self.manifest: dict[Any, Any] = {}
def init_app(self) -> None:
"""
Main entry point which will delegate to other methods in
order to fully init the app
"""
self.pre_init()
self.check_secret_key()
self.configure_session()
# Configuration of logging must be done first to apply the formatter properly
self.configure_logging()
# Configuration of feature_flags must be done first to allow init features
# conditionally
self.configure_feature_flags()
self.configure_db_encrypt()
self.setup_db()
self.configure_celery()
self.enable_profiling()
self.setup_event_logger()
self.setup_bundle_manifest()
self.register_blueprints()
self.configure_wtf()
self.configure_middlewares()
self.configure_cache()
with self.superset_app.app_context():
self.init_app_in_ctx()
self.post_init()
Ensure that the init_app
method is called to complete the initialization process. This method delegates to other methods to fully initialize the app, including setting up the database, configuring Celery, and registering blueprints.
Additionally, you can refer to the docker/docker-init.sh
script provided by Superset for initializing the application in a Docker environment. This script includes steps to apply database migrations, create an admin user, and set up roles and permissions. Here is the relevant part of the script for creating an admin user:
# Create an admin user
echo_step "2" "Starting" "Setting up admin user ( admin / $ADMIN_PASSWORD )"
superset fab create-admin \
--username admin \
--firstname Superset \
--lastname Admin \
--email admin@superset.com \
--password $ADMIN_PASSWORD
echo_step "2" "Complete" "Setting up admin user"
Make sure to follow these steps and ensure that all necessary attributes and configurations are properly set up before running the superset fab create-admin
command. If you encounter an AttributeError
, it might be due to a missing or improperly configured attribute in the SupersetAppInitializer
class or an issue with the environment setup [1][2].
#### Details
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.To continue the conversation, mention @dosu.
Comment From: rusackas
Closing this out since the bot didn't get any feedback, it's gone quite silent/stale, and it's more of a help issue than a bug. Happy to move it to a Discussion if warrante.