Skip to content

Intermittent not_authed SlackAPIError errors #20

@StephenTangCook

Description

@StephenTangCook

Background

We've been seeing intermittent authorize errors coming from the slack-cloudflare-workers / slack-edge part of our Slack app:

AuthorizeError: Failed to authorize (error: SlackAPIError: Failed to call auth.test due to not_authed: {"ok":false,"error":"not_authed","headers":{}}

I haven't discovered a pattern. It happens for various workspaces, some enterprise installs and some not, some queries include userId and some don't.

I have even encountered this locally on occasion. When I saw it locally, even refreshing the app did not appear to fix it. It seemed to be stuck in a bad state, affecting the app's ability to handle any incoming Slack API events. The issue seemed to be resolved after I performed a complete re-install of the Slack app, although I can't say if this would extend to non-local environments.

Debugging

From on the auth.test API docs, this error happens when "omitting a token". If that's true, then I assume that the bot_token passed into the Slack API client here somehow ends up being empty, since that is the client used to call auth.test.

I have investigated one particular event and verified the installation for the workspace was correctly in our KV store, and that it contained a valid bot_id. I manually tested the bot_id with the auth.test method and received a success response.

Next Steps

I am adding an authorizeErrorHandler on our SlackOAuthApp to log additional info about the response to see if we can learn anything useful. @seratch I'm wondering if you have any ideas on where to look next?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions