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

   ### Apache Airflow version
   
   2.10.5
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   While trying to test a small DAG that sends an email and Teams webhook, it 
fails to send the email, even though all values (Client ID, Tenant ID, Client 
Secret) are correct. I even tested a small Python script to make sure the 
values were correct.
   
   Granted User.ReadAll and Mail.Send as per permissions
   
   
   ```
   e207a3c9daa2
    ▶ Log message source details
   [2025-03-29, 18:13:42 UTC] {local_task_job_runner.py:123} ▶ Pre task 
execution logs
   [2025-03-29, 18:13:42 UTC] {base.py:84} INFO - Retrieving connection 
'azure_graph_email'
   [2025-03-29, 18:13:42 UTC] {msgraph.py:258} INFO - Creating Microsoft Graph 
SDK client v1.0 for conn_id: azure_graph_email
   [2025-03-29, 18:13:42 UTC] {msgraph.py:263} INFO - Host: 
https://graph.microsoft.com/
   [2025-03-29, 18:13:42 UTC] {msgraph.py:264} INFO - Base URL: 
https://graph.microsoft.com/v1.0
   [2025-03-29, 18:13:42 UTC] {msgraph.py:265} INFO - Tenant id: xxxxxxxxxxxxxx
   [2025-03-29, 18:13:42 UTC] {msgraph.py:266} INFO - Client id: 
xxxxxxxxxxxxxxxxxxx
   [2025-03-29, 18:13:42 UTC] {msgraph.py:267} INFO - Client secret: ***
   [2025-03-29, 18:13:42 UTC] {msgraph.py:268} INFO - API version: v1.0
   [2025-03-29, 18:13:42 UTC] {msgraph.py:269} INFO - Scope: 
['https://graph.microsoft.com/.default']
   [2025-03-29, 18:13:42 UTC] {msgraph.py:270} INFO - Verify: True
   [2025-03-29, 18:13:42 UTC] {msgraph.py:271} INFO - Timeout: None
   [2025-03-29, 18:13:42 UTC] {msgraph.py:272} INFO - Trust env: True
   [2025-03-29, 18:13:42 UTC] {msgraph.py:273} INFO - Authority: 
https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxx
   [2025-03-29, 18:13:42 UTC] {msgraph.py:274} INFO - Disable instance 
discovery: False
   [2025-03-29, 18:13:42 UTC] {msgraph.py:275} INFO - Allowed hosts: 
['https://login.microsoftonline.com/xxxxxxxxxxxxxxxxx']
   [2025-03-29, 18:13:42 UTC] {msgraph.py:276} INFO - Proxies: {}
   [2025-03-29, 18:13:42 UTC] {msgraph.py:277} INFO - MSAL Proxies: {}
   [2025-03-29, 18:13:42 UTC] {msgraph.py:278} INFO - HTTPX Proxies: {}
   [2025-03-29, 18:13:42 UTC] {taskinstance.py:341} ▼ Post task execution logs
   [2025-03-29, 18:13:42 UTC] {standard_task_runner.py:124} ERROR - Failed to 
execute job 63 for task send_email (Scopes should be an empty list or a list of 
strings; 107)
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 274, in _run_raw_task
       TaskInstance._execute_task_with_callbacks(
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 3161, in _execute_task_with_callbacks
       result = self._execute_task(context, task_orig)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 3185, in _execute_task
       return _execute_task(self, context, task_orig)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 768, in _execute_task
       result = _execute_callable(context=context, **execute_callable_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 734, in _execute_callable
       return ExecutionCallableRunner(
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/operator_helpers.py",
 line 252, in run
       return self.func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/baseoperator.py",
 line 424, in wrapper
       return func(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/microsoft/azure/operators/msgraph.py",
 line 140, in execute
       self.defer(
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/baseoperator.py",
 line 1800, in defer
       raise TaskDeferred(trigger=trigger, method_name=method_name, 
kwargs=kwargs, timeout=timeout)
   airflow.exceptions.TaskDeferred
   During handling of the above exception, another exception occurred:
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/task/task_runner/standard_task_runner.py",
 line 117, in _start_by_fork
       ret = args.func(args, dag=self.dag)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/cli_config.py", 
line 49, in command
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/cli.py", line 
116, in wrapper
       return f(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/commands/task_command.py",
 line 483, in task_run
       task_return_code = _run_task_by_selected_method(args, _dag, ti)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/commands/task_command.py",
 line 256, in _run_task_by_selected_method
       return _run_raw_task(args, ti)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/commands/task_command.py",
 line 341, in _run_raw_task
       return ti._run_raw_task(
              ^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 97, in wrapper
       return func(*args, session=session, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 3006, in _run_raw_task
       return _run_raw_task(
              ^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 288, in _run_raw_task
       ti.defer_task(exception=defer, session=session)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 94, in wrapper
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 3194, in defer_task
       _defer_task(ti=self, exception=exception, session=session)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/api_internal/internal_api_call.py",
 line 166, in wrapper
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 94, in wrapper
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py",
 line 1677, in _defer_task
       trigger_row = Trigger.from_object(exception.trigger)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/api_internal/internal_api_call.py",
 line 166, in wrapper
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 97, in wrapper
       return func(*args, session=session, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/trigger.py", 
line 143, in from_object
       classpath, kwargs = trigger.serialize()
                           ^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/microsoft/azure/triggers/msgraph.py",
 line 160, in serialize
       "api_version": self.api_version,
                      ^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/microsoft/azure/triggers/msgraph.py",
 line 190, in api_version
       return self.hook.api_version
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/microsoft/azure/hooks/msgraph.py",
 line 180, in api_version
       self.get_conn()  # Make sure config has been loaded through get_conn to 
have correct api version!
       ^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/microsoft/azure/hooks/msgraph.py",
 line 298, in get_conn
       auth_provider = AzureIdentityAuthenticationProvider(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/kiota_authentication_azure/azure_identity_authentication_provider.py",
 line 34, in __init__
       AzureIdentityAccessTokenProvider(
     File 
"/home/airflow/.local/lib/python3.12/site-packages/kiota_authentication_azure/azure_identity_access_token_provider.py",
 line 42, in __init__
       raise TypeError(f"Scopes {list_error}")
   TypeError: Scopes should be an empty list or a list of strings
   [2025-03-29, 18:13:42 UTC] {local_task_job_runner.py:266} INFO - Task exited 
with return code 1
   [2025-03-29, 18:13:42 UTC] {taskinstance.py:3901} INFO - 0 downstream tasks 
scheduled from follow-on schedule check
   [2025-03-29, 18:13:42 UTC] {local_task_job_runner.py:245} ▲▲▲ Log group end
   
   ```
   
   
   <img width="876" alt="Image" 
src="https://github.com/user-attachments/assets/37f5690a-8338-4c91-afb3-02b46b3145aa";
 />
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   Just run the DAG as usual and it will fail to send the email / connect to 
Graph API every single time.
   
   ### Operating System
   
   Ubuntu 22.04 LTS
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### 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: [email protected]

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

Reply via email to