Skip to content

Commit d2c1947

Browse files
committed
Fix a bug where LambdaS3OAuthFlow does not work when settings arg is given
1 parent c37b104 commit d2c1947

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

slack_bolt/adapter/aws_lambda/lambda_s3_oauth_flow.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import boto3
77

8+
from slack_bolt.authorization.authorize import InstallationStoreAuthorize
89
from slack_bolt.oauth import OAuthFlow
910
from slack_sdk import WebClient
1011
from slack_sdk.oauth.installation_store.amazon_s3 import AmazonS3InstallationStore
@@ -55,6 +56,16 @@ def __init__(
5556
bucket_name=installation_bucket_name,
5657
client_id=settings.client_id,
5758
)
59+
60+
# Set up authorize function to surely use this installation_store.
61+
# When a developer use a settings initialized outside this constructor,
62+
# the settings may already have pre-defined authorize.
63+
# In this case, the /slack/events endpoint doesn't work along with the OAuth flow.
64+
settings.authorize = InstallationStoreAuthorize(
65+
logger=logger,
66+
installation_store=settings.installation_store
67+
)
68+
5869
OAuthFlow.__init__(self, client=client, logger=logger, settings=settings)
5970

6071
@property

0 commit comments

Comments
 (0)