From a947c7498cb32c441ffb5e15619da6698dbf2af0 Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Tue, 5 Apr 2022 12:50:47 +0000 Subject: [PATCH] [server] log client region on bad bearer auth requests related to https://github.com/gitpod-io/gitpod/issues/8703 --- components/server/src/auth/bearer-authenticator.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/server/src/auth/bearer-authenticator.ts b/components/server/src/auth/bearer-authenticator.ts index d89e4c0ceebc48..8b63dc27afff4a 100644 --- a/components/server/src/auth/bearer-authenticator.ts +++ b/components/server/src/auth/bearer-authenticator.ts @@ -6,6 +6,7 @@ import { UserDB } from "@gitpod/gitpod-db/lib"; import { GitpodTokenType } from "@gitpod/gitpod-protocol"; +import { log } from "@gitpod/gitpod-protocol/lib/util/logging"; import * as crypto from "crypto"; import * as express from "express"; import { IncomingHttpHeaders } from "http"; @@ -48,6 +49,11 @@ export class BearerAuth { await this.auth(req); } catch (e) { if (isBearerAuthError(e)) { + // (AT) while investigating https://github.com/gitpod-io/gitpod/issues/8703 we + // came to the assumption that a workspace pod might start talking to a server pod + // from the other cluster, which is not db-sync'd yet. + // Logging this should allow us to test this assumption. + log.warn("Bearer auth error.", e, { clientRegion: req.get("x-glb-client-region") }); res.status(401).send(e.message); return; }