Skip to content

Commit

Permalink
πŸ› Do not raise an exception when default AWS credentials fail (#924)
Browse files Browse the repository at this point in the history
No exception when default aws creds fail
  • Loading branch information
Koncopd authored Jan 3, 2025
1 parent b5a612f commit eb775b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lamindb_setup/core/_aws_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import time

from lamin_utils import logger
from upath.implementations.cloud import S3Path

HOSTED_REGIONS = [
Expand Down Expand Up @@ -40,8 +41,15 @@ def __init__(self):

# this is cached so will be resued with the connection initialized
fs = S3FileSystem(cache_regions=True)
fs.connect()
self.anon: bool = fs.session._credentials is None
try:
fs.connect()
self.anon: bool = fs.session._credentials is None
except Exception as e:
logger.warning(
f"There is a problem with your default AWS Credentials: {e}\n"
"`anon` mode will be used for all non-managed buckets."
)
self.anon = True
self.anon_public: bool | None = None
if not self.anon:
try:
Expand Down

0 comments on commit eb775b7

Please sign in to comment.