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

   ### Apache Airflow Provider(s)
   
   sftp
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-sftp==4.1.0
   
   ### Apache Airflow version
   
   2.4.2 Python 3.10
   
   ### Operating System
   
   Debian 11 (Official docker image)
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   Base image is apache/airflow:2.4.2-python3.10
   
   
   ### What happened
   
   When combining Taskflow API and SFTPOperator, it throws an exception that 
didn't happen with apache-airflow-providers-sftp 4.0.0
   
   ### What you think should happen instead
   
   The DAG should work as expected
   
   ### How to reproduce
   
   ```python
   import pendulum
   
   from airflow import DAG
   from airflow.decorators import task
   from airflow.providers.sftp.operators.sftp import SFTPOperator
   
   with DAG(
       "example_sftp",
       schedule="@once",
       start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
       catchup=False,
       tags=["example"],
   ) as dag:
   
       @task
       def get_file_path():
           return "test.csv"
   
       local_filepath = get_file_path()
   
       upload = SFTPOperator(
           task_id=f"upload_file_to_sftp",
           ssh_conn_id="sftp_connection",
           local_filepath=local_filepath,
           remote_filepath="test.csv",
       )
   ```
   
   ### Anything else
   
   ```logs
   [2022-10-27T15:21:38.106+0000]` {logging_mixin.py:120} INFO - 
[2022-10-27T15:21:38.102+0000] {dagbag.py:342} ERROR - Failed to import: 
/opt/airflow/dags/test.py
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.10/site-packages/airflow/models/dagbag.py", 
line 338, in parse
       loader.exec_module(new_module)
     File "<frozen importlib._bootstrap_external>", line 883, in exec_module
     File "<frozen importlib._bootstrap>", line 241, in 
_call_with_frames_removed
     File "/opt/airflow/dags/test.py", line 21, in <module>
       upload = SFTPOperator(
     File 
"/home/airflow/.local/lib/python3.10/site-packages/airflow/models/baseoperator.py",
 line 408, in apply_defaults
       result = func(self, **kwargs, default_args=default_args)
     File 
"/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/sftp/operators/sftp.py",
 line 116, in __init__
       if len(self.local_filepath) != len(self.remote_filepath):
   TypeError: object of type 'PlainXComArg' has no len()
   ```
   
   It looks like the offending code was introduced in commit 
5f073e38dd46217b64dbc16d7b1055d89e8c3459
   
   ### Are you willing to submit PR?
   
   - [X] 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: commits-unsubscr...@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to