Skip to content

Commit 2af8163

Browse files
author
Michael Mooring
committed
AS-176 open-parse file URL support, 4
1 parent a7e9cf0 commit 2af8163

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Diff for: src/openparse/doc_parser.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,31 @@ def _get_s3_client(self, endpoint_url: Optional[str] = None) -> boto3.client:
230230
raise ValueError("CLOUDFLARE_ACCOUNT_ID environment variable is required for R2 storage")
231231
endpoint_url = f"https://{account_id}.r2.cloudflarestorage.com"
232232

233+
# Log the configuration being used
234+
logger.info("🟠☁️ Creating S3 client with configuration:")
235+
logger.info(f"Endpoint URL: {endpoint_url}")
236+
logger.info(f"Access Key ID present: {bool(os.getenv('R2_ACCESS_KEY_ID'))}")
237+
logger.info(f"Secret Access Key present: {bool(os.getenv('R2_SECRET_ACCESS_KEY'))}")
238+
233239
client_kwargs = {
234240
'service_name': 's3',
235241
'endpoint_url': endpoint_url,
236242
'aws_access_key_id': os.getenv('R2_ACCESS_KEY_ID'),
237243
'aws_secret_access_key': os.getenv('R2_SECRET_ACCESS_KEY'),
238-
'region_name': os.getenv('R2_REGION', 'auto'), # Default to 'auto' if not specified
239-
# R2 compatibility settings
244+
'region_name': os.getenv('R2_REGION', 'auto'),
240245
'config': boto3.Config(
241246
request_checksum_calculation='WHEN_REQUIRED',
242247
response_checksum_validation='WHEN_REQUIRED'
243248
)
244249
}
245250

251+
# Log the actual values being used (without exposing secrets)
252+
logger.info("S3 client kwargs:")
253+
safe_kwargs = client_kwargs.copy()
254+
if 'aws_secret_access_key' in safe_kwargs:
255+
safe_kwargs['aws_secret_access_key'] = '***'
256+
logger.info(f"Client kwargs: {safe_kwargs}")
257+
246258
# Remove None values
247259
client_kwargs = {k: v for k, v in client_kwargs.items() if v is not None}
248260

0 commit comments

Comments
 (0)