airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Log URL redirecting to No XCom error

Open sam-gen-cop opened this issue 1 year ago • 4 comments

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.10.1

What happened?

The Log URL (ti.log_url) from the triggered retry email doesn't redirect to the Logs when clicked but instead shows 'No XCom' as the error in the Airflow UI. The Logs are shown when a time in future is selected as the base_date in the UI.

Before changing the base_date in the UI,

image

After adding 1 second to the base_date in UI,

image

What you think should happen instead?

I think the issue might be due to milli seconds getting truncated which causes the difference between the execution datetime (untruncated) and the execution datetime rendered - base_date (truncated) in the ti.log_url

How to reproduce

Here is the DAG to reproduce the issue,

from airflow.decorators import dag, task
from datetime import datetime, timedelta

@dag(
    dag_id='default_email_on_retry_example',
    schedule_interval='@once',
    start_date=datetime(2023, 1, 1),
    catchup=False,
    default_args={
        'email': ['[email protected]'],  
        'email_on_retry': True,  
        'email_on_failure': False,  
    },
)
def default_email_on_retry_dag():

    @task
    def success_task():
        print("This task will always succeed!")

    @task(task_id='retry_task', retries=3, retry_delay=timedelta(seconds=15))
    def retry_task():
        print("This task will retry and fail.")
        raise Exception("Simulated task failure for retry.")

    success = success_task()
    retry = retry_task()

    success >> retry

default_email_on_retry_dag()

image

Click the Log Link from the email triggered by the DAG

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Amazon (AWS) MWAA

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

sam-gen-cop avatar Nov 25 '24 08:11 sam-gen-cop

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

boring-cyborg[bot] avatar Nov 25 '24 08:11 boring-cyborg[bot]

+1

dada-engineer avatar Nov 29 '24 14:11 dada-engineer

+1

moz3 avatar Dec 16 '24 23:12 moz3

Hi @potiuk could you please assign the issue to me?

pranav-cs-1 avatar Dec 19 '24 05:12 pranav-cs-1

+1 in 2025

Qnog-frog avatar Jun 29 '25 09:06 Qnog-frog

I tested it in 2.11.0 and it works as expected. It fails for 2.10.3, though - tested both locally today

lpillmann avatar Jul 24 '25 17:07 lpillmann

FYI I think this was fixed in #50306, and the fix is available in 2.11.

isaiahiruoha avatar Jul 24 '25 23:07 isaiahiruoha

Is there some docs that the BASE_URL needs to end with a slash for this to work correctly or is this considered a new bug?

dada-engineer avatar Jul 28 '25 06:07 dada-engineer

Is there some docs that the BASE_URL needs to end with a slash for this to work correctly or is this considered a new bug?

Worth if you could create a PR for that @dada-engineer -> either documenting or (better) checking that BASE_URL cannot end with /.

potiuk avatar Jul 29 '25 09:07 potiuk

Is there some docs that the BASE_URL needs to end with a slash for this to work correctly or is this considered a new bug?

Worth if you could create a PR for that @dada-engineer -> either documenting or (better) checking that BASE_URL cannot end with /.

Created

dada-engineer avatar Aug 18 '25 07:08 dada-engineer