The publication desk needs to know which media import stopped producing usable assets, while a Node.js Express error tracking API may capture only that a worker threw an exception. Those are different claims. An error dashboard becomes useful for incident reconstruction only after the importer defines what each acknowledgment actually establishes.
TL;DR: In a Node.js Express application, capture handled exceptions, unhandled exceptions, and unhandled rejections with the message, stack trace, environment, release, and available request/user context. Join that evidence to an application-owned import record, and alert separately when an expected completion signal misses its deadline. Basic error grouping is sufficient for finding recurring failures; causal reconstruction across services requires more than matching identifiers.
Preserve the uncertainty.
The design here starts with the question an operator must answer after an alert: did this scheduled edition fail before attempting work, during processing, or after producing assets but before recording completion? Treat those as competing explanations, rather than choosing the explanation with the most alarming stack trace. The concrete records and numbers below are illustrative design inputs, not production measurements or monitoring-provider fields.
Which evidence would distinguish a failed import from a missing receipt?
Start with a deliberately uncomfortable constraint: the media output and the monitoring event are separate writes. Unless the application establishes a stronger relationship between them, an acknowledgment from error capture says nothing about the durability of an imported asset, and an absent completion event says nothing conclusive about whether the asset exists. A storage-oriented investigation must keep those boundaries visible even when a dashboard puts the records next to each other.
Suppose an edition is due at 06:00, with an application-defined deadline of 06:12. Give the scheduled edition a stable identifier and each attempt its own identifier. Keep the expected edition record outside the worker's assumption that it will start successfully: a worker cannot reliably describe an attempt it never made. Define the output acceptance rule too. For a feed expected to contain media, a completed request with zero accepted assets should not satisfy the edition's completion condition; an intentionally empty edition needs an explicit reason.
An exception is positive evidence that a particular operation failed. A missing receipt is weaker: the worker may never have started, may still be running, or may have written output without recording its acknowledgment. These cases deserve different investigation steps, even if they all trigger the same deadline alert. Check the output evidence before retrying an operation that could publish duplicate assets.
That last case matters.
The application record should distinguish scheduled edition, attempt, accepted output, and receipt. These are proposed application concepts, with no claim that a vendor supplies a transaction connecting them. Grouping identical exceptions can shorten the search for a recurring symptom, but it cannot turn two independent acknowledgments into a commit protocol.
Build the reconstruction around competing explanations
Use a small evidence evaluator to make the distinction reviewable. The following standalone Python example models three hypothetical editions at the same observation time; it neither calls an API nor implements an Express error handler. Its fields belong exclusively to this local example. The useful property is that an edition with output but no receipt stays distinguishable from an edition for which no attempt is recorded.
from datetime import datetime
def instant(value):
return datetime.fromisoformat(value)
def classify(record, now):
if record["receipt"] and record["accepted_assets"] > 0:
return "completion recorded"
if now <= instant(record["deadline"]):
return "deadline pending"
if record["accepted_assets"] > 0:
return "inspect output before retrying; receipt absent"
if record["error_group"]:
return "inspect captured failure for this attempt"
if record["attempt"] is None:
return "no attempt recorded; inspect scheduler evidence"
return "attempt recorded without accepted output; inspect worker evidence"
records = [
{
"edition": "morning-photos",
"attempt": "photos-a1",
"deadline": "2026-11-28T06:12:00+00:00",
"accepted_assets": 18,
"receipt": False,
"error_group": None,
},
{
"edition": "morning-audio",
"attempt": "audio-a1",
"deadline": "2026-11-28T06:12:00+00:00",
"accepted_assets": 0,
"receipt": False,
"error_group": "audio-decode",
},
{
"edition": "morning-video",
"attempt": None,
"deadline": "2026-11-28T06:12:00+00:00",
"accepted_assets": 0,
"receipt": False,
"error_group": None,
},
]
now = instant("2026-11-28T06:15:00+00:00")
for record in records:
print(record["edition"] + ": " + classify(record, now))
The photo edition has 18 accepted assets, so treating its missing receipt as proof that nothing happened would discard relevant evidence. The audio edition points the operator toward an error group. The video edition calls for scheduler evidence first. None of these classifications claims to establish root cause, and the code deliberately does not turn an observed condition into an automatic retry.
It also assumes that the supplied output count is trustworthy. In deployment, define who can write that count, which acceptance checks precede it, and how the operator can inspect the corresponding assets; otherwise the evaluator merely promotes an unverified counter into an authoritative answer. Retain contradictory evidence for review instead of overwriting it with the latest attempt's status.
The trade-off is extra application bookkeeping. The benefit is a narrower next question when a deadline expires, including the important case where the safest next action is inspection rather than another write.
How should an Express error tracking API capture request context?
With that model established, error capture has a precise job: explain an attempted operation. Preserve the original message and stack, then associate environment, release, and the minimum request/user context needed for investigation. For an Express request that initiates an import, retain the application correlation identifier at the handoff to background work. A scheduled attempt should carry its actual import identity; manufacturing an HTTP request context would make the resulting record harder to trust.
Capture caught failures as well. A handler that converts an exception into an application response can still leave an edition unresolved, and excluding that exception from tracking would make a deliberately handled failure resemble an unexplained disappearance.
Process-level unhandled exceptions and unhandled rejections require their own coverage, but the reconstruction design should not assume that their callbacks still have the original request or that one final network request guarantees delivery. Preserve the evidence boundary between the application and the collector. If capture itself is unacknowledged, record the resulting uncertainty rather than concluding that the application had no errors.
Keep the stack intact.
For an event already identified during triage, this read-only Python companion retrieves its evidence without asserting a response envelope. Set INFRAI_API_ORIGIN to the HTTPS API origin configured for the deployment, INFRAI_API_KEY to an authorized key, and ERROR_EVENT_ID to an actual captured event identifier. The origin excludes the version path. The example retries rate limits with exponential backoff, honors Retry-After, and surfaces error bodies; it makes no writes and requires no idempotency key. Its timeout is 20 seconds per request, with at most 5 attempts; these are client settings, not a service latency promise or a total elapsed-time bound.
import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.parse import quote, urlsplit
from urllib.request import Request, urlopen
origin = os.environ["INFRAI_API_ORIGIN"].rstrip("/")
parts = urlsplit(origin)
if parts.scheme != "https" or not parts.netloc or parts.path:
raise ValueError("Configure an HTTPS API origin without a path")
event_id = quote(os.environ["ERROR_EVENT_ID"], safe="")
api_key = os.environ["INFRAI_API_KEY"]
for attempt in range(5):
request = Request(
origin + "/v1/errors/get/{event_id}".format(event_id=event_id),
headers={"Authorization": "Bearer " + api_key},
method="GET",
)
try:
with urlopen(request, timeout=20) as response:
if not 200 <= response.status < 300:
raise RuntimeError(f"Unexpected status: {response.status}")
result = json.load(response)
print(json.dumps(result, indent=2))
break
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"HTTP {error.code}: {detail}") from error
delay = min(2 ** attempt, 16)
retry_after = error.headers.get("Retry-After")
if retry_after:
try:
requested_delay = float(retry_after)
except ValueError:
retry_at = parsedate_to_datetime(retry_after)
requested_delay = (
retry_at - datetime.now(timezone.utc)
).total_seconds()
delay = max(delay, requested_delay)
time.sleep(max(0, delay))
Group and event inspection can support a basic admin errors page: investigate the particular attempt, then inspect related events for recurrence. A group is a useful index, not the identity of the scheduled edition. One recurring failure can affect several editions, while several different failures can occur during attempts to produce one edition.
Likewise, trace_id and span_id in logs can support loose correlation, but a matching string does not supply a span tree or establish execution order across services. Specify distributed trace investigation separately if that is the evidence the operator needs. Source-map reverse mapping, native crash symbolication, and session replay also belong in the selection criteria when the investigation extends beyond readable backend stacks.
Select tools against the unanswered investigation question
The practical comparison is between evidence roles, because scheduled-success monitoring and exception investigation answer different questions. These are candidates for the stated roles, not claims of measured completeness, delivery guarantees, or interchangeable feature sets. Consult the integration documentation before selecting the particular configuration.
| Option | Question it should help investigate | Selection boundary for this importer |
|---|---|---|
| Sentry | Which application exception affected this attempt? | Evaluate when exception investigation drives the decision; still define accepted output and the edition deadline in the application. |
| Datadog Logs | What log evidence surrounds the missing edition? | Evaluate for an existing log-centered investigation workflow; log presence alone does not establish asset acceptance. |
| Grafana | How should the operator view the import evidence already collected? | Evaluate for a dashboard-centered workflow with existing data sources; a visualization still needs an explicit definition of accepted output. |
| Healthchecks | Did the expected scheduled-success signal arrive? | Appropriate to evaluate for silent scheduled-job failure; keep exception detail available for the follow-up investigation. |
| Basic REST capture | Which basic error group and event correspond to this attempt? | Fits a small backend and an application-owned errors page; choose separate deadline monitoring and notification delivery. |
Infrai offers a self-describing REST API with no SDK required, plus one API key and one bill across 295 routes and 20 modules. Its public discovery provides request and response schemas plus runnable examples, so wiring error capture starts with inspecting a capability rather than learning a new SDK. That suits basic grouping and an application-owned errors page. A Node.js importer and a Python investigation tool can use HTTP directly, with runnable examples in 10 languages to guide each integration. The shared credential is a separate operational advantage: a media backend that also uses storage and scheduling can configure a common credential instead of maintaining a separate integration credential for each of those services. Those conveniences reduce integration bookkeeping; they don't establish a transaction between stored assets and monitoring evidence.
Choose basic capture for readable backend exceptions and an admin triage view. Choose a more specialized investigation workflow when the acceptance criteria require distributed span trees, source-map reverse mapping, crash symbolication, or session replay. For the scheduled-import problem, evaluate Healthchecks alongside error tracking: a missed success signal needs its own deadline and notification path, even when every captured exception is grouped correctly.
Roll out against the three evidence states
Start with one media feed and retain its existing deadline alert while adding attempt identity and error context. Exercise the three illustrative states above: output without a receipt, a captured processing failure, and no recorded attempt. Check that the operator can distinguish them without treating an error group's status as proof of asset durability.
Don't automate the retry yet.
Only move the alert after the success signal represents accepted output and the investigation view preserves earlier attempts. Keep deadline evaluation and notification delivery explicit, whether a scheduled-job monitor handles them or an application-owned poller does; the rollout is complete when a missing edition leads to a defensible next action rather than another unexplained write.
Sources
References:
Top comments (0)