shahar1 opened a new issue, #42439:
URL: https://github.com/apache/airflow/issues/42439

   ### Apache Airflow Provider(s)
   
   google
   
   ### Versions of Apache Airflow Providers
   
   10.15.0
   
   ### Apache Airflow version
   
   2.6.3
   
   ### Operating System
   
   Debian
   
   ### Deployment
   
   Google Cloud Composer
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   When using `GCSToLocalFilesystemOperator` on a non-existing object, the 
resulted exception is regarding a `NoneType` object with no `size` attribute - 
which is True, but it would be better to raise an exception that the file 
simply does not exist.
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   Use the `GCSToLocalFilesystemOperator` with a non-existing `OBJECT_NAME`
   ```python
       gcs_to_fs = GCSToLocalFilesystemOperator(
           task_id="gcs_to_fs",
           bucket=BUCKET,  # <- exists
           object_name=OBJECT_NAME, # <- does not exist
       )
   ```
   You'll get an exception similar to this:
   
   ```
   Traceback (most recent call last):
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/providers/google/cloud/transfers/gcs_to_local.py",
 line 118, in execute
       file_size = hook.get_size(bucket_name=self.bucket, 
object_name=self.object_name)
                   
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/opt/python3.11/lib/python3.11/site-packages/airflow/providers/google/cloud/hooks/gcs.py",
 line 968, in get_size
       blob_size = blob.size
                   ^^^^^^^^^
   AttributeError: 'NoneType' object has no attribute 'size'
   ```
   
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to