diff --git a/packages/server/src/server/services/httpService/api/v1/routers/fcmRouter.ts b/packages/server/src/server/services/httpService/api/v1/routers/fcmRouter.ts index 36b4f26c..27e83144 100644 --- a/packages/server/src/server/services/httpService/api/v1/routers/fcmRouter.ts +++ b/packages/server/src/server/services/httpService/api/v1/routers/fcmRouter.ts @@ -4,7 +4,7 @@ import { RouterContext } from "koa-router"; import { FileSystem } from "@server/fileSystem"; import { GeneralInterface } from "@server/api/v1/interfaces/generalInterface"; import { Success } from "../responses/success"; -import { isEmpty } from "@server/helpers/utils"; +import { isEmpty, isNotEmpty } from "@server/helpers/utils"; export class FcmRouter { static async getClientConfig(ctx: RouterContext, _: Next) { @@ -14,8 +14,8 @@ export class FcmRouter { // As such, we need to manually add it back in so the client doesn't break when reading the file. // This is a monkeypatch. The client only requires the first part of the client_id, before the `-`. // This value is the same as the project number, so we can just use that. - if (isEmpty(googleServices.oauth_client)) { - googleServices.oauth_client = [ + if (isNotEmpty(googleServices.client) && isEmpty(googleServices.client[0].oauth_client)) { + googleServices.client[0].oauth_client = [ { // The project number exists in multiple fields. Fallback if the project number is not found. client_id: googleServices?.project_info?.project_number ??