diff --git a/deno-runtime/main.ts b/deno-runtime/main.ts index 342246322..9735a7c1b 100644 --- a/deno-runtime/main.ts +++ b/deno-runtime/main.ts @@ -9,6 +9,7 @@ if (!Deno.args.includes('--subprocess')) { } import { JsonRpcError } from 'jsonrpc-lite'; +import type { App } from "@rocket.chat/apps-engine/definition/App.ts"; import * as Messenger from './lib/messenger.ts'; import { AppObjectRegistry } from './AppObjectRegistry.ts'; @@ -30,6 +31,13 @@ async function requestRouter({ type, payload }: Messenger.JsonRpcRequest): Promi const logger = new Logger(method); AppObjectRegistry.set('logger', logger); + const app = AppObjectRegistry.get('app'); + + if (app) { + // Same logic as applied in the ProxiedApp class previously + (app as unknown as Record).logger = logger; + } + switch (true) { case method.startsWith('app:'): { const result = await handleApp(method, params);