Skip to content

Getting slack_bolt.AsyncMultiTeamsAuthorization error after user installs the slack app #1257

@X0R0X

Description

@X0R0X

Hello, I am using GCP Virtual Server for hosting, docker (compose) for deployment. I currently use ngrok to tunnel traffic to the slack server.
I use (also, currently) FileInstallationStore to persist the user installation. When I install the app via /slack/install, everything seems fine - no exception is being thrown. However when i receive /slack/events, i got this error:
Although the app should be installed into this workspace, the AuthorizeResult (returned value from authorize) for it was not found.

The problem is that user installation never gets persisted to the file, my ./data/installations directory is empty, although ./data/states is not. The thing is, when I was running this locally (not on GCP VM), everything worked fine.

My Slack App setup is:

        self._slack_server = AsyncApp(
            logger=slack_server_logger,
            token=slack_bot_token,
            signing_secret=slack_bot_sign_secret,
            oauth_settings=AsyncOAuthSettings(
                client_id=slack_bot_client_id,
                client_secret=slack_bot_client_secret,
                scopes=[
                    "chat:write",
                    "channels:read",
                    "channels:history",
                    "channels:join",
                    "groups:read",
                    "im:history",
                    "im:read",
                    "im:write",
                    "channels:read",
                    "users:read",                  
                ],

                user_scopes=[
                    "im:history",
                    "im:read",
                    "im:write",
                    "mpim:history",
                    "mpim:read",
                    "mpim:write",
                    "channels:read",
                    "channels:write",
                    "channels:history",
                    "users:read",
                    "chat:write",
                    "groups:history",
                    "groups:write",
                    "groups:read",
                    "reactions:read"
                ],
                # todo PG / Redis ...
                installation_store=FileInstallationStore(
                    base_dir="./data/installations"
                ),
                state_store=FileOAuthStateStore(
                    expiration_seconds=3600, base_dir="./data/states"
                ),
                # redirect_uri="https://w12-34.ngrok-free.app",
                redirect_uri=None,
                redirect_uri_path="/slack/authorize_app",
                install_path="/slack/install",
            )
        )

My callbacks:

        @self._fast_api.get("/slack/authorize_app")
        async def _oauth_authorize(req: Request):
            print("AUTHORIZE:::", pprint(req))
            return await self._bolt_handler.handle(req)

        @self._fast_api.get("/slack/install")
        async def _oauth_install(req: Request):
            return await self._bolt_handler.handle(req)

        # for oauth redirect
        @self._fast_api.get("/slack/oauth_redirect")
        async def _oauth_redirect(req: Request):
            return await self._bolt_handler.handle(req)

        @self._fast_api.post('/slack/events')
        async def _oauth_slack_events(req: Request):
            return await self._bolt_handler.handle(req)

Callbacks /slack/oauth_redirect and /slack/authorize_app never get called.

Reproducible in:

Sorry, I am really not sure how to reproduce this :(

The slack_bolt version

slack==0.0.2
slack_bolt==1.22.0
slack_sdk==3.34.0
slackclient==2.9.4

Python runtime version

Python 3.12

OS info

Debian 12

Steps to reproduce:

I am not sure how to reproduce this, I just think I am doing something stupid...

Expected result:

User Installation gets persisted to the ./data/installations directory.

Actual result:

Because installation does not get persisted to the ./data/installations directory, the app does not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions