Team ID not set to "none" when doing an org-wide install
(Filling out the following details about bugs will help us solve your issue sooner.)
Reproducible in:
pip freeze | grep slack
python --version
sw_vers && uname -v # or `ver`
The Slack SDK version
slack_sdk==3.33.1
Python runtime version
Python 3.11.2
OS info
Darwin Kernel Version 23.5.0: Wed May 1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103
Steps to reproduce:
Update the test_org_installation in tests/slack_sdk/oauth/installation_store/test_amazon_s3.py by changing the installation to contain a team_id:
installation = Installation(
app_id="AO111",
enterprise_id="EO111",
team_id="TO111",
user_id="UO111",
bot_id="BO111",
bot_token="xoxb-O111",
bot_scopes=["chat:write"],
bot_user_id="UO222",
is_enterprise_install=True,
)
- Run
python -m pytest tests/slack_sdk/oauth/installation_store/test_amazon_s3.py - See the test fail
Expected result:
I expect this test to pass. When I install a Slack App and use Python Bolt it passes a team_id into the installation resulting in a S3 key that is the enteprise id and team id:
However, once the installation is complete, the find_installation method sets the team_id to "none" when is_enterprise_install is True.
Actual result:
b'<?xml version="1.0" encoding="UTF-8"?>\n<Error>\n <Code>NoSuchKey</Code>\n <Message><![CDATA[The specified key does not exist.]]></Message>\n <Key>111.222/EO111-none/bot-latest</Key>\n <RequestID>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestID>\n</Error>'
2025-01-23 09:55:08 DEBUG Response headers: {'x-amzn-requestid': 'm6ENjsFOtYFIlf1APhqfRE3mwPerldiGZ8xe0YBpaUL0AE7oJdWx'}
2025-01-23 09:55:08 DEBUG Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<Error>\n <Code>NoSuchKey</Code>\n <Message><![CDATA[The specified key does not exist.]]></Message>\n <Key>111.222/EO111-none/bot-latest</Key>\n <RequestID>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestID>\n</Error>'
2025-01-23 09:55:08 DEBUG Event needs-retry.s3.GetObject: calling handler <function _update_status_code at 0x102c6a980>
2025-01-23 09:55:08 DEBUG Event needs-retry.s3.GetObject: calling handler <botocore.retryhandler.RetryHandler object at 0x10a06d710>
2025-01-23 09:55:08 DEBUG No retry needed.
2025-01-23 09:55:08 DEBUG Event needs-retry.s3.GetObject: calling handler <bound method S3RegionRedirectorv2.redirect_from_error of <botocore.utils.S3RegionRedirectorv2 object at 0x10a06cc10>>
2025-01-23 09:55:08 WARNING Failed to find bot installation data for enterprise: EO111, team: none: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. :bow:
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Hi @GabeL7r thanks for writing in 💯
Is this behavior showing up in production or in some sort of test?
@WilliamBergamin it's showing up in a Slack Developer Sandbox. I haven't tried outside of a Developer Sandbox because I don't have an enterprise Slack Account :)
Here is an example of what the Installation field gets populated with, note team_id is not null:
{
"app_id": "A07N8S****",
"enterprise_id": "E07N0***",
"enterprise_name": "Clairity Sanbbox",
"enterprise_url": "https://clairity-sandbox.enterprise.slack.com/",
"team_id": "T07P47U****",
"team_name": "Clairity Sanbbox",
"bot_token": "***",
"bot_id": "B07P4Q***",
"bot_user_id": "U07NJ***",
"bot_scopes": ["assistant:write", "canvases:write", "channels:history", "channels:manage", "chat:write", "commands", "groups:history", "groups:read", "im:history", "im:write", "reactions:read", "reactions:write", "usergroups:read", "users:read", "groups:write"],
"bot_refresh_token": null,
"bot_token_expires_at": null,
"user_id": "U07NF***",
"user_token": null,
"user_scopes": null,
"user_refresh_token": null,
"user_token_expires_at": null,
"incoming_webhook_url": null,
"incoming_webhook_channel": null,
"incoming_webhook_channel_id": null,
"incoming_webhook_configuration_url": null,
"is_enterprise_install": true,
"token_type": "bot",
"installed_at": 1737645424.510618,
"custom_values": {}
}
This is interesting it is the first time we encounter this 🤔 let me ask internally try to get more info on this
But since "is_enterprise_install": true then this line should make the team_id=None when looking up the installation
@GabeL7r would you be able to share the source code to you're app and it manifest?
I would like to try and reproduce this on my end, there should not be any difference with a sandbox or enterprise
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.
As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number.