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

   ### Under which category would you file this issue?
   
   Airflow Core
   
   ### Apache Airflow version
   
   3.4.0
   
   ### What happened and how to reproduce it?
   
   Running `airflow info --file-io` crashes instead of uploading the report and 
printing a shareable link.
   
   **1. file.io's anonymous upload endpoint no longer works.** This is 
reproducible with a plain `curl`:
   
   ```
   $ curl -sD - -o /dev/null -X POST -d test https://file.io
   HTTP/2 301
   location: https://www.file.io/
   server: cloudflare
   
   $ curl -sD - -o /dev/null -X POST -d test https://www.file.io/
   HTTP/2 405
   allow: GET, HEAD, OPTIONS
   ```
   
   Even following file.io's own [developer 
docs](https://www.file.io/developers) exactly — `POST
   https://file.io/` as `multipart/form-data` with a `file` field, rather than 
a raw-body POST — the
   same redirect happens:
   
   ```
   $ curl -X POST -F "[email protected]" https://file.io/
   HTTP/2 301
   location: https://www.file.io/
   ```
   
   `https://www.file.io/` is now served as a static site (S3 behind Cloudflare) 
that only answers
   `GET`/`HEAD`/`OPTIONS` — `POST` is rejected outright, regardless of body 
format.
   
   **2. Airflow's own error handling for this case is broken, independent of 
(1).** In
   `_upload_text_to_fileio` 
(`airflow-core/src/airflow/cli/commands/info_command.py`):
   
   ```python
   def _upload_text_to_fileio(content):
       """Upload text file to File.io service and return link."""
       resp = httpx.post("https://file.io";, content=content)
       if resp.status_code not in [200, 201]:
           print(resp.json())
           raise FileIoException("Failed to send report to file.io service.")
       ...
   ```
   
   Because a redirect/error response has an HTML body (not JSON), `resp.json()` 
raises
   `json.JSONDecodeError` (a `ValueError`) — and that call isn't wrapped in a 
`try`/`except`. So the
   intended `raise FileIoException(...)` on the next line is never reached; an 
unhandled `ValueError`
   propagates out of the function instead.
   
   The `tenacity.retry` decorator on this function only retries 
`FileIoException`
   (`retry=tenacity.retry_if_exception_type(FileIoException)`), so this 
`ValueError` isn't retried —
   it's re-raised on the very first attempt. `_send_report_to_fileio`'s `except 
FileIoException as ex:`
   doesn't catch a plain `ValueError` either, so it propagates all the way up 
and crashes
   `airflow info --file-io` with an unhandled traceback, instead of the 
intended, friendly
   `"Failed to send report to file.io service."` message.
   
   ### What you think should happen instead?
   
   `airflow info --file-io` should either:
   - upload successfully to a working anonymous file-sharing backend, or
   - fail with the clear, intended `FileIoException` message — not an unhandled 
`ValueError`/
     `json.JSONDecodeError` traceback — when the backend is unavailable.
   
   ### Operating System
   
   _No response_
   
   ### Deployment
   
   None
   
   ### Apache Airflow Provider(s)
   
   _No response_
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   _No response_
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### 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