aissue: error reporting for Python, Django, Flask and FastAPI
Send your app's errors to AIssue, which groups them into issues, finds the code responsible and explains how to fix it.
Django: 3 steps
pip install aissue
# settings.py
MIDDLEWARE = [
# ... your existing middleware
"aissue.middleware.AIssueMiddleware",
]
# where the app runs (.env, Docker, your host's settings)
AISSUE_DSN=https://<key>@<your-aissue-host>/<domain id>
Copy the exact AISSUE_DSN from your domain page in AIssue (Set up error reporting → Django). That's it: unhandled view errors are reported when DEBUG = False, in a background thread, without slowing down requests.
Also report errors you catch and log
LOGGING = {
"version": 1,
"handlers": {
"console": {"class": "logging.StreamHandler"},
"aissue": {"class": "aissue.logging.AIssueHandler", "level": "ERROR"},
},
"root": {"handlers": ["console", "aissue"], "level": "INFO"},
}
Any logger.exception(...) (or logger.error(..., exc_info=True)) is then reported. Records without exception information are ignored.
Flask
pip install "aissue[flask]"
from flask import Flask
from aissue.flask import AIssue
app = Flask(__name__)
AIssue(app) # reads AISSUE_DSN from app.config or the environment
Or with an application factory:
aissue_ext = AIssue()
def create_app():
app = Flask(__name__)
aissue_ext.init_app(app)
return app
Unhandled exceptions (Flask's got_request_exception) are reported with status 500, the path, method, filtered query parameters, allow-listed headers, release, environment and the request's breadcrumbs. abort(404) and other HTTP errors are not reported. Nothing is reported while app.debug is on unless you pass log_in_debug=True.
Options, as keyword arguments or AISSUE_* keys in app.config: dsn, environment, release, enabled, log_in_debug, header_allowlist, timeout, max_breadcrumbs, breadcrumb_log_level, http_breadcrumbs. To send a user id, pass a callable that gets the request and returns an opaque id (never an email):
AIssue(app, user_id=lambda request: getattr(current_user, "id", None)) # e.g. Flask-Login
FastAPI and Starlette
pip install "aissue[fastapi]"
from fastapi import FastAPI
import aissue.fastapi
app = FastAPI()
aissue.fastapi.init(app) # reads AISSUE_DSN; or init(app, dsn="https://...", environment="production")
aissue.fastapi.init adds aissue.asgi.AIssueMiddleware, a plain ASGI middleware. Use it directly for Starlette or any other ASGI app:
from aissue.asgi import AIssueMiddleware
app.add_middleware(AIssueMiddleware, dsn="https://...") # Starlette / FastAPI
app = AIssueMiddleware(app) # any ASGI app
Unhandled exceptions are reported and then re-raised, so the framework still answers 500. Handled errors (HTTPException, your exception handlers) are not reported. Events are handed to the SDK's background thread, so nothing blocks the event loop. Options: the same as Flask, plus report_4xx; user_id is a callable that gets the ASGI scope (by default the id of an authenticated Starlette scope["user"] is used).
Any other Python app (scripts, workers)
import aissue
aissue.init() # reads AISSUE_DSN; or aissue.init(dsn="https://...")
try:
charge(order)
except Exception as exc:
aissue.capture_exception(exc)
raise
Without a DSN (or with an invalid one), aissue.init() logs a warning and returns a disabled client that does nothing: it never raises. Call aissue.flush() before a short-lived script exits to wait until queued events are sent.
Breadcrumbs
Each error is sent with a short trail of what happened before it (at most 100 items, oldest first):
- Requests: the incoming request (
GET /checkout, path only). - Logs: Python
loggingrecords at INFO and above (the level your loggers actually emit). The SDK's own logs andurllib3/requestsinternals are skipped. - Outbound HTTP: calls made with
requests: method, URL without the query string, and status code. Requests to AIssue itself are skipped. - Your own:
import aissue
aissue.add_breadcrumb("Applied coupon", category="checkout", level="info", data={"items": 3})
aissue.clear_breadcrumbs()
type can be default, http, navigation, ui, log or query; level one of debug, info, warning, error; data a flat dict of strings, numbers and booleans (at most 20 keys); messages are cut at 1000 characters.
Each request (Django, Flask, FastAPI/ASGI) gets its own trail, kept in a contextvars variable, so concurrent requests, threads and asyncio tasks never mix. Outside a request, breadcrumbs go to one process-wide trail. To give a background job its own trail:
with aissue.breadcrumb_scope():
process(job)
Breadcrumb messages and data go through the same filters as the rest of the event: values under sensitive keys become [Filtered], and secrets in text (password=..., Bearer ..., API keys, card numbers, email addresses) are redacted.
Option (aissue.init, Flask, ASGI) |
Django setting | Default | |
|---|---|---|---|
max_breadcrumbs |
AISSUE_MAX_BREADCRUMBS |
50 |
Trail length, up to 100. 0 turns breadcrumbs off. |
breadcrumb_log_level |
AISSUE_BREADCRUMB_LOG_LEVEL |
"INFO" |
Lowest log level recorded. None turns log breadcrumbs off. |
http_breadcrumbs |
AISSUE_HTTP_BREADCRUMBS |
True |
Record outbound requests calls. |
If you already use the Sentry SDK, you don't need this package: set its DSN to the AIssue DSN instead (see your domain page).
Settings
All optional except the DSN. Each can also be an environment variable of the same name where noted.
| Setting | Default | |
|---|---|---|
AISSUE_DSN |
env AISSUE_DSN |
https://<key>@<host>/<domain id> |
AISSUE_ENVIRONMENT |
env AISSUE_ENVIRONMENT |
e.g. production |
AISSUE_RELEASE |
auto-detected | Deployed version. A git commit SHA lets AIssue read the exact deployed code. Detected from AISSUE_RELEASE, VERCEL_GIT_COMMIT_SHA, RENDER_GIT_COMMIT, RAILWAY_GIT_COMMIT_SHA, HEROKU_SLUG_COMMIT, SOURCE_VERSION, CF_PAGES_COMMIT_SHA, GITHUB_SHA, COMMIT_SHA, GIT_SHA, GIT_COMMIT. In Docker, pass one in, e.g. --build-arg/ENV GIT_SHA=$(git rev-parse HEAD). |
AISSUE_ENABLED |
True (env AISSUE_ENABLED for aissue.init) |
Turn reporting off. The Django middleware then removes itself. |
AISSUE_LOG_IN_DEBUG |
False |
Also report while DEBUG = True |
AISSUE_REPORT_4XX |
False |
Also report Http404, PermissionDenied and 400 errors |
AISSUE_SEND_REQUEST_BODY |
False |
Send form data and JSON bodies (up to 64 KB), sensitive keys still filtered. Other bodies (plain text, XML, raw multipart) are never sent. |
AISSUE_SEND_USER_EMAIL |
False |
Send the signed-in user's email (the user id is always sent) |
AISSUE_HEADER_ALLOWLIST |
safe default | Header names to send |
AISSUE_TIMEOUT |
5 |
Seconds per request to AIssue |
AISSUE_MAX_BREADCRUMBS, AISSUE_BREADCRUMB_LOG_LEVEL, AISSUE_HTTP_BREADCRUMBS |
See Breadcrumbs |
Legacy: AISSUE_API_KEY + AISSUE_BASE_URL still work instead of AISSUE_DSN.
A missing or invalid DSN never stops your app from starting: the middleware logs an aissue warning and removes itself.
What is sent
- Error details: exception type and message, the traceback, and structured stack frames (file, function, line, and whether it is your code or a library).
- Request: path, method, and query parameters. Values under sensitive-looking keys (
password,token,api_key,session,cookie,auth,card…) are replaced with[Filtered]. - Headers: an allowlist only (
User-Agent,Content-Type,Accept,Accept-Language,Host,Origin,Refererwithout its query string…). NeverCookie,Authorization, API-key or client-IP headers. - User: the signed-in user's id only.
- Deployment: release and environment.
- Breadcrumbs: see Breadcrumbs.
AIssue scrubs every event again on arrival. Sending never raises into your app. Events are dropped, not queued without limit, if AIssue is unreachable. The SDK backs off when AIssue asks it to (HTTP 429).
Troubleshooting
- Nothing arrives: check
DEBUG = False(orAISSUE_LOG_IN_DEBUG = True; Flask:app.debugoff orlog_in_debug=True) and thatAISSUE_DSNis set where the app runs. Look foraissuewarnings in your logs, e.g.AIssue is disabledor a rejected key (401). - No log breadcrumbs: only records your loggers actually emit are recorded. Python's default level is WARNING, so set
logging.basicConfig(level=logging.INFO)(or your logging config) to see INFO records. - 404s show up: they're not reported unless
AISSUE_REPORT_4XX = True. - Turn it off temporarily:
AISSUE_ENABLED = False.
License
MIT (see LICENSE).
Metadata
Release files for aissue 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aissue-2.0.1.tar.gz | 38.5 kB | With provenance | Details for aissue-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aissue-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for aissue-2.0.1-py3-none-any.whl |
Total release size: 65.8 kB
Release files / aissue-2.0.1.tar.gz
| Download URL | aissue-2.0.1.tar.gz |
|---|---|
| Size | 38.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8db9bc093ef503034c957ad8ab2db601e44aa959acfd00befdc965d348ad1bd1
|
|
BLAKE2b-256 checksum How to use checksums |
3944aa933361ba795bc385b94a0dd1f675b0d6650c0a3850c7376de03a640785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / aissue-2.0.1-py3-none-any.whl
| Download URL | aissue-2.0.1-py3-none-any.whl |
|---|---|
| Size | 27.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05b7ec0d8f2ab1c9c7b9439d5c209c11a246d6de743f91de07c511f999e15d0a
|
|
BLAKE2b-256 checksum How to use checksums |
07526a7aaedc8c5c9bf02edfc60f601a607cb4e936864cf93668c397921d259b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for aissue 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for aissue-2.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.