Skip to content
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

Team ID not set to "none" when doing an org-wide install #1639

Open
GabeL7r opened this issue Jan 23, 2025 · 2 comments
Open

Team ID not set to "none" when doing an org-wide install #1639

GabeL7r opened this issue Jan 23, 2025 · 2 comments
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info oauth

Comments

@GabeL7r
Copy link

GabeL7r commented Jan 23, 2025

(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,
        )
  1. Run python -m pytest tests/slack_sdk/oauth/installation_store/test_amazon_s3.py
  2. 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:

Image

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. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

@WilliamBergamin WilliamBergamin added needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info oauth and removed untriaged labels Jan 23, 2025
@WilliamBergamin
Copy link
Contributor

Hi @GabeL7r thanks for writing in 💯

Is this behavior showing up in production or in some sort of test?

@GabeL7r
Copy link
Author

GabeL7r commented Jan 23, 2025

@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": {}
}

@GabeL7r GabeL7r changed the title Team ID Incorrectly Set to "none" when finding installation for org-wide install Team ID not set to "none" when doing an org-wide install Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info oauth
Projects
None yet
Development

No branches or pull requests

2 participants