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

🐛 Do not raise an exception when default AWS credentials fail #924

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading