Skip to content

Commit

Permalink
Fix logger assignment to App instance on request handling
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert committed Dec 27, 2023
1 parent 0ed2fd6 commit 18cc8d2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deno-runtime/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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>('app');

if (app) {
// Same logic as applied in the ProxiedApp class previously
(app as unknown as Record<string, unknown>).logger = logger;
}

switch (true) {
case method.startsWith('app:'): {
const result = await handleApp(method, params);
Expand Down

0 comments on commit 18cc8d2

Please sign in to comment.