Description
The proxy handler's graceful error handling (return 204 on upstream failure) doesn't match prefixed analytics routes like /_proxy/meta-tr.
proxy-handler.ts, catch block:
if (path.includes("/collect") || path.includes("/tr") || path.includes("/events")) {
event.node.res.statusCode = 204;
return "";
}
The Meta Pixel route is /_proxy/meta-tr/** → https://www.facebook.com/tr/**. When the upstream is unreachable, the path /_proxy/meta-tr does not contain the substring /tr (it's -tr), so the check fails and the handler throws a 502 instead of silently returning 204.
Impact
~6K server-side Sentry errors/day from POST /_proxy/meta-tr with "Failed to reach upstream".
Suggestion
Match against the resolved upstream target URL (which does contain /tr) instead of the incoming proxy path. Or match all /_proxy/** routes in the catch block since they're all analytics endpoints.
Description
The proxy handler's graceful error handling (return 204 on upstream failure) doesn't match prefixed analytics routes like
/_proxy/meta-tr.proxy-handler.ts, catch block:
The Meta Pixel route is
/_proxy/meta-tr/**→https://www.facebook.com/tr/**. When the upstream is unreachable, the path/_proxy/meta-trdoes not contain the substring/tr(it's-tr), so the check fails and the handler throws a 502 instead of silently returning 204.Impact
~6K server-side Sentry errors/day from
POST /_proxy/meta-trwith"Failed to reach upstream".Suggestion
Match against the resolved upstream target URL (which does contain
/tr) instead of the incoming proxy path. Or match all/_proxy/**routes in the catch block since they're all analytics endpoints.