deepujain opened a new pull request, #63694:
URL: https://github.com/apache/airflow/pull/63694

   ## Summary
   
   When using a custom XCom backend that needs credentials (e.g. to fetch from 
S3), `deserialize_value` can be called from the scheduler while it evaluates 
task dependencies (e.g. branch/skip rules for SkipMixin operators). In that 
context there is no running task, so connection resolution may fail with errors 
like `NoCredentialsError`. This change documents that behavior and recommends 
that custom backends guard in `deserialize_value`: when not in task context, 
return the raw reference or a safe default instead of performing a remote fetch.
   
   ## Change
   
   * **airflow-core/docs/core-concepts/xcoms.rst**: Under "Custom XCom 
Backends", added a **Scheduler and non-task context** note explaining that 
`deserialize_value` may be invoked from the scheduler when evaluating 
dependencies, that task/connection context may be unavailable there, and that 
backends that need credentials should detect non-task context (e.g. missing 
`AIRFLOW_CTX_DAG_ID`) and return the raw reference or a safe default to avoid 
`NoCredentialsError`.
   
   ## Why no new tests
   
   Docs-only change; no code or behavior change. The note describes existing 
behavior and recommended practice for custom backends.
   
   ## Fixes
   
   Fixes #50491
   


-- 
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