Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix(server): stop logging expected unauthorized oRPC errors

Amruth Pillai12cf57e54b37
diff --git a/apps/server/src/openapi/handler.ts b/apps/server/src/openapi/handler.ts
index a2d6f1482..6ac78739b 100644
--- a/apps/server/src/openapi/handler.ts
+++ b/apps/server/src/openapi/handler.ts
@@ -1,6 +1,6 @@
import { SmartCoercionPlugin } from "@orpc/json-schema";
import { OpenAPIHandler } from "@orpc/openapi/fetch";
-import { onError } from "@orpc/server";
+import { onError, ORPCError } from "@orpc/server";
import { RequestHeadersPlugin, StrictGetMethodPlugin } from "@orpc/server/plugins";
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
import { env } from "@reactive-resume/env/server";
@@ -20,6 +20,8 @@ const openAPIHandler = new OpenAPIHandler(openAPIRouter, {
],
interceptors: [
onError((error) => {
+ // Signed-out or expired callers are routine; their 401 still reaches the client.
+ if (error instanceof ORPCError && error.code === "UNAUTHORIZED") return;
console.error("[OpenAPI]", error);
}),
],
diff --git a/apps/server/src/rpc/handler.ts b/apps/server/src/rpc/handler.ts
index 5a8dcf68e..92d98a2f0 100644
--- a/apps/server/src/rpc/handler.ts
+++ b/apps/server/src/rpc/handler.ts
@@ -1,4 +1,4 @@
-import { onError } from "@orpc/server";
+import { onError, ORPCError } from "@orpc/server";
import { RPCHandler } from "@orpc/server/fetch";
import { BatchHandlerPlugin, RequestHeadersPlugin, StrictGetMethodPlugin } from "@orpc/server/plugins";
import router from "@reactive-resume/api/routers";
@@ -9,6 +9,8 @@ const rpcHandler = new RPCHandler(router, {
plugins: [new BatchHandlerPlugin(), new RequestHeadersPlugin(), new StrictGetMethodPlugin()],
interceptors: [
onError((error) => {
+ // Signed-out or expired callers are routine; their 401 still reaches the client.
+ if (error instanceof ORPCError && error.code === "UNAUTHORIZED") return;
console.error("[oRPC Server]", error);
}),
],