Error unregistered external sink

Hi,

I’m getting this issue

Workflow referenced an unregistered external sink { ifaceName: e[32m'defaultWorkerLogger'

This is the base setup of my sinks

const sinks: InjectedSinks<LogSinks> = {
            logger: {
                debug: {
                    fn(workflowInfo: WorkflowInfo, message: string) {
                        logger.debug(
                            TemporalWorkerClient.createLoggable(workflowInfo, message),
                        );
                    },
                },
                info: {
                    fn(workflowInfo: WorkflowInfo, message: string) {
                        logger.info(TemporalWorkerClient.createLoggable(workflowInfo, message));
                    },
                },
                warn: {
                    fn(workflowInfo: WorkflowInfo, message: string) {
                        logger.warn(TemporalWorkerClient.createLoggable(workflowInfo, message));
                    },
                },
                error: {
                    fn(workflowInfo: WorkflowInfo, message: string) {
                        logger.error(
                            TemporalWorkerClient.createLoggable(workflowInfo, message),
                        );
                    },
                },
                critical: {
                    fn(workflowInfo: WorkflowInfo, message: string) {
                        logger.critical(
                            TemporalWorkerClient.createLoggable(workflowInfo, message),
                        );
                    },
                },
            },
        };

        workerOptions.sinks = sinks;

        const worker = await Worker.create(workerOptions);

and this is the setup of my log sinks

import { proxySinks, Sinks } from '@temporalio/workflow';

export interface LogSinks extends Sinks {
    logger: {
        debug(message: string): void;
        info(message: string): void;
        warn(message: string): void;
        error(message: string): void;
        critical(message: string): void;
    };
}

export const { logger } = proxySinks<LogSinks>();

I am calling them from my individual workflows using the logger - proxy sinks.

What am I doing wrong and/or is there a good way to debug this?

Thanks!

Hi Stefanie,

I believe you’ll need to spread the default sinks into your custom sink object in order to reference defaultWorkerLogger, e.g.

import { defaultSinks, InjectedSinks, Worker } from '@temporalio/worker';

...

const sinks: InjectedSinks<LogSinks> = {
  ...defaultSinks(),
  logger: {
    debug: {
      fn(workflowInfo: WorkflowInfo, message: string) {
        logger.debug(
          TemporalWorkerClient.createLoggable(workflowInfo, message),

Let us know if it helps.