diff --git a/src/api/util.ts b/src/api/util.ts index 077d13d..4d516bb 100644 --- a/src/api/util.ts +++ b/src/api/util.ts @@ -27,6 +27,15 @@ export class ErrorResponse extends Error { Object.defineProperty(this, ErrorResponseSymbol, {enumerable: false, value: ErrorResponseSymbol}); + if (response.status === 502 && + response.headers.get('Server') === 'cloudflare' && + response.headers.get('Content-Type')?.match(/^text\/html(;|$)/) + ) { + // Cloudflare returns it's own HTML error page for HTTP 502 errors + // Logging this isn't helpful so just discard it + body = 'Bad Gateway\n'; + } + if (body instanceof ArrayBuffer) { body = (new TextDecoder()).decode(body); } diff --git a/src/util/debug.ts b/src/util/debug.ts index 329b29e..d426ac7 100644 --- a/src/util/debug.ts +++ b/src/util/debug.ts @@ -70,10 +70,10 @@ function applyFormatters(args: [formatter: string, ...args: unknown[]], self = d const censor_fields = [ 'token', - // NA OIDC - 'access_token', 'id_token', + // OAuth/OIDC + 'access_token', 'id_token', 'refresh_token', 'client_secret', // Coral - 'accessToken', 'supportId', + 'accessToken', 'supportId', 'naIdToken', // Moon 'serialNumber', 'notificationToken', ];