Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't log "403" from worker serve-logs as "Unknown error". #37933

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

ashb
Copy link
Member

@ashb ashb commented Mar 6, 2024

If you make a request to http://localhost:8793/ it would get denied from this block on L82:

            auth = request.headers.get("Authorization")
            if auth is None:
                logger.warning("The Authorization header is missing: %s.", request.headers)
                abort(403)

abort is internally implemented to raise an exception. However since that abort() call was inside a try/except block, it was getting caught under the execpt Exception: fallback and running this:

        except Exception:
            logger.warning("Unknown error", exc_info=True)
            abort(403)

So nothing was wrong with the behaviour (it still 403d the request), it's just the logs were slightly confusing.

If you make a request to `http://localhost:8793/` it would get denied
from this block on L82:

```python
            auth = request.headers.get("Authorization")
            if auth is None:
                logger.warning("The Authorization header is missing: %s.", request.headers)
                abort(403)
``

abort is internally implemented to raise an exception. However since
that `abort()` call was inside a try/except block, it was getting caught
under the `execpt Exception:` fallback and running this:

```
        except Exception:
            logger.warning("Unknown error", exc_info=True)
            abort(403)
```

So nothing was wrong with the behaviour (it still 403d the request),
it's just the logs were slightly confusing.
@potiuk potiuk merged commit 7cebff8 into apache:main Mar 7, 2024
56 checks passed
@jedcunningham jedcunningham deleted the logging-fix-worker-server-logs branch March 8, 2024 15:52
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Mar 14, 2024
howardyoo pushed a commit to howardyoo/airflow that referenced this pull request Mar 18, 2024
)

If you make a request to `http://localhost:8793/` it would get denied
from this block on L82:

```python
            auth = request.headers.get("Authorization")
            if auth is None:
                logger.warning("The Authorization header is missing: %s.", request.headers)
                abort(403)
``

abort is internally implemented to raise an exception. However since
that `abort()` call was inside a try/except block, it was getting caught
under the `execpt Exception:` fallback and running this:

```
        except Exception:
            logger.warning("Unknown error", exc_info=True)
            abort(403)
```

So nothing was wrong with the behaviour (it still 403d the request),
it's just the logs were slightly confusing.
howardyoo pushed a commit to howardyoo/airflow that referenced this pull request Mar 31, 2024
)

If you make a request to `http://localhost:8793/` it would get denied
from this block on L82:

```python
            auth = request.headers.get("Authorization")
            if auth is None:
                logger.warning("The Authorization header is missing: %s.", request.headers)
                abort(403)
``

abort is internally implemented to raise an exception. However since
that `abort()` call was inside a try/except block, it was getting caught
under the `execpt Exception:` fallback and running this:

```
        except Exception:
            logger.warning("Unknown error", exc_info=True)
            abort(403)
```

So nothing was wrong with the behaviour (it still 403d the request),
it's just the logs were slightly confusing.
utkarsharma2 pushed a commit to astronomer/airflow that referenced this pull request Apr 22, 2024
)

If you make a request to `http://localhost:8793/` it would get denied
from this block on L82:

```python
            auth = request.headers.get("Authorization")
            if auth is None:
                logger.warning("The Authorization header is missing: %s.", request.headers)
                abort(403)
``

abort is internally implemented to raise an exception. However since
that `abort()` call was inside a try/except block, it was getting caught
under the `execpt Exception:` fallback and running this:

```
        except Exception:
            logger.warning("Unknown error", exc_info=True)
            abort(403)
```

So nothing was wrong with the behaviour (it still 403d the request),
it's just the logs were slightly confusing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants