Skip to content

Commit c7616af

Browse files
rubenfonsecasthulb
authored andcommitted
fix(shared): skip user agent on much older botocore versions (#2366)
fix: don't crash on old botocore versions
1 parent 67915cf commit c7616af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

aws_lambda_powertools/shared/user_agent.py

+4
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ def register_feature_to_resource(resource, feature):
160160

161161
def inject_user_agent():
162162
if inject_header:
163+
# Some older botocore versions doesn't support register_initializer. In those cases, we disable the feature.
164+
if not hasattr(botocore, "register_initializer"):
165+
return
166+
163167
# Customize botocore session to inject Powertools header
164168
# See: https://github.com/boto/botocore/pull/2682
165169
botocore.register_initializer(_initializer_botocore_session)

0 commit comments

Comments
 (0)