hcengineering/platform · error

Not implemented

Error message

Not implemented

What it means

getIntegrationOwnerTG is a placeholder: it immediately throws Error('Not implemented') and the rest of the intended implementation is commented out behind a TODO:FIXME. Any template/provider resolution that needs the Telegram integration owner will always fail until the function is implemented.

Source

Thrown at plugins/telegram-resources/src/utils.ts:35

import { getContactChannel } from '@hcengineering/contact-resources'
import { getClient } from '@hcengineering/presentation'
import { type TemplateDataProvider } from '@hcengineering/templates'
import { getMetadata } from '@hcengineering/platform'

import telegram from './plugin'

export async function getCurrentEmployeeTG (): Promise<string | undefined> {
  const me = getCurrentEmployee()
  const client = getClient()
  const employee = await client.findOne(contact.mixin.Employee, { _id: me })
  if (employee !== undefined) {
    return await getContactChannel(employee, contact.channelProvider.Telegram)
  }
}

export async function getIntegrationOwnerTG (provider: TemplateDataProvider): Promise<string | undefined> {
  // TODO: FIXME
  throw new Error('Not implemented')
  // const value = provider.get(setting.class.Integration)
  // if (value === undefined) return
  // const client = getClient()
  // const employeeAccount = await client.findOne(contact.class.PersonAccount, {
  //   _id: value.modifiedBy as PersonId
  // })
  // if (employeeAccount !== undefined) {
  //   const employee = get(employeeByIdStore).get(employeeAccount.person as Ref<Employee>)
  //   if (employee !== undefined) {
  //     return await getContactChannel(employee, contact.channelProvider.Telegram)
  //   }
  // }
}

export function isTelegramNotificationsAvailable (): boolean {
  const botEndpoint = getMetadata(telegram.metadata.BotUrl) ?? ''

  return botEndpoint !== ''

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Implement the function per the commented-out sketch: resolve the Integration setting, find the PersonAccount by modifiedBy, and return the owner identifier
  2. Avoid calling getIntegrationOwnerTG until the feature is implemented; gate the calling feature behind a flag
  3. Patch/wrap it locally with a working implementation using provider.get(setting.class.Integration) and contact.class.PersonAccount lookup
  4. Track upstream for the FIXME resolution and update

Example fix

// before
export async function getIntegrationOwnerTG (provider: TemplateDataProvider): Promise<string | undefined> {
  throw new Error('Not implemented')
}
// after
export async function getIntegrationOwnerTG (provider: TemplateDataProvider): Promise<string | undefined> {
  const value = provider.get(setting.class.Integration)
  if (value === undefined) return
  const client = getClient()
  const account = await client.findOne(contact.class.PersonAccount, { _id: value.modifiedBy as PersonId })
  return account?.name ?? account?._id
}
Defensive patterns

Strategy: fallback

Validate before calling

// Cannot validate: function always throws. Feature-detect by avoiding the call:
const isTelegramOwnerSupported = false // until FIXME is resolved upstream
if (isTelegramOwnerSupported) {
  owner = await getIntegrationOwnerTG(provider)
}

Try / catch

let owner: string | undefined
try {
  owner = await getIntegrationOwnerTG(provider)
} catch (err) {
  if (err instanceof Error && err.message === 'Not implemented') {
    owner = undefined // degrade gracefully: render template without owner
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Any code path that calls getIntegrationOwnerTG — e.g. building notification templates that need the integration owner account — regardless of arguments; the error is unconditional.

Common situations: Enabling Telegram notification templates in a build where this helper was never finished; upgrades where a feature depends on this unfinished utility.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/afc60a7255a91d6d. Report an issue: GitHub.