@@ -520,11 +520,20 @@ def _sync_upload_to_oss(signed_url: str, zip_path: str) -> int:
520520 file_size = os .path .getsize (zip_path )
521521 size_mb = file_size / (1024 * 1024 )
522522 if file_size > FC_OSS_FILE_SIZE_WARNING :
523- logger .warning (
524- f"Uploading large file: { zip_path } ({ size_mb :.2f} MB) to OSS" ,
523+ max_mb = FC_OSS_FILE_SIZE_WARNING / (1024 * 1024 )
524+ reason = (
525+ f"Package too large: { zip_path } ({ size_mb :.2f} MB) "
526+ f"exceeds the maximum allowed size of { max_mb :.0f} MB "
527+ f"for OSS upload. The upload was not attempted. "
528+ f"Reduce the package size (e.g. exclude large files via "
529+ f"env var FC_ZIP_EXCLUDE_PATTERNS) or raise the limit via "
530+ f"env var FC_OSS_FILE_SIZE_WARNING (current: "
531+ f"{ FC_OSS_FILE_SIZE_WARNING } bytes)."
525532 )
533+ logger .error (reason )
526534 raise OSSUploadError (
527- f"Uploading large file: { zip_path } ({ size_mb :.2f} MB) to OSS" ,
535+ reason ,
536+ file_size = file_size ,
528537 )
529538
530539 logger .debug (
@@ -541,11 +550,18 @@ def _sync_upload_to_oss(signed_url: str, zip_path: str) -> int:
541550
542551 if response .status_code != 200 :
543552 error_msg = response .text
553+ logger .error (
554+ f"OSS upload failed | File: { zip_path } "
555+ f"({ size_mb :.2f} MB), Status: { response .status_code } , "
556+ f"Response: { error_msg } " ,
557+ )
544558 raise OSError (
545559 f"OSS upload failed ({ response .status_code } ): { error_msg } " ,
546560 )
547561
548562 return response .status_code
563+ except OSSUploadError :
564+ raise
549565 except Exception as e :
550566 raise RuntimeErrorWithCode (
551567 "OSS upload error" ,
0 commit comments