hcengineering/platform · error
Calendar service URL or token is not defined
Error message
Calendar service URL or token is not defined
What it means
The calendar integration signout function needs the Calendar service URL and an auth token, both read from client metadata. If either metadata value is undefined the integration cannot call the calendar service, so it throws immediately.
Source
Thrown at plugins/calendar-resources/src/api.ts:32
//
import { getMetadata } from '@hcengineering/platform'
import presentation from '@hcengineering/presentation'
import login from '@hcengineering/login'
import { type Integration } from '@hcengineering/account-client'
import {
type IntegrationClient,
getIntegrationClient as getIntegrationClientRaw,
request
} from '@hcengineering/integration-client'
import calendar from './plugin'
import { calendarIntegrationKind } from '@hcengineering/calendar'
export async function signout (integration: Integration, client: IntegrationClient): Promise<void> {
const url = getMetadata(calendar.metadata.CalendarServiceURL)
const token = getMetadata(presentation.metadata.Token)
if (url === undefined || token === undefined) {
throw new Error('Calendar service URL or token is not defined')
}
const connection = await client.getConnection(integration)
const email = integration.data?.email ?? connection?.data?.email
if (email === undefined) {
throw new Error('Email is not defined in integration')
}
await request({
baseUrl: url,
path: `/signout?value=${email}`,
method: 'GET',
token
})
}
export async function disconnect (integration: Integration): Promise<void> {
const integrationClient = await getIntegrationClient()
const result = await integrationClient.removeIntegration(integration.socialId, integration.workspaceUuid)
if (result !== undefined && result.connectionRemoved) {View on GitHub (pinned to 63e28dc964)
Solutions
- Configure calendar.metadata.CalendarServiceURL in the deployment metadata/branding setup
- Ensure the user has a valid session so presentation.metadata.Token is set
- Verify the calendar service is deployed and its URL is reachable before enabling the integration
Example fix
// before: metadata missing, error thrown
// after: check before invoking integration
const url = getMetadata(calendar.metadata.CalendarServiceURL)
const token = getMetadata(presentation.metadata.Token)
if (url === undefined || token === undefined) {
console.warn('Calendar integration unavailable: missing service URL or token')
} else {
await signout(integration, client)
} Defensive patterns
Strategy: validation
Validate before calling
const url = getMetadata(calendar.metadata.CalendarServiceURL) const token = getMetadata(presentation.metadata.Token) if (url === undefined || token === undefined) return // skip signout, integration not configured
Type guard
const isCalendarConfigured = (): boolean => getMetadata(calendar.metadata.CalendarServiceURL) !== undefined && getMetadata(presentation.metadata.Token) !== undefined
Try / catch
try {
await signout(integration, client)
} catch (err) {
if ((err as Error).message.includes('URL or token is not defined')) {
logger.warn('Calendar signout skipped: service not configured')
} else throw err
} Prevention
- Set CalendarServiceURL in deployment metadata/branding before enabling calendar integration
- Verify Token metadata is present in the auth bootstrap
- Add a config preflight check listing required metadata at app startup
When it happens
Trigger: Calling signout (directly or via disconnect/disconnectAll) when calendar.metadata.CalendarServiceURL or presentation.metadata.Token metadata is not set — e.g. calendar service not deployed/configured or user session lacks a token.
Common situations: Self-hosted deployments where the CalendarServiceURL metadata was never configured; reverse proxy not exposing the calendar service; user signed in through a flow that does not populate the presentation Token; misconfigured frontend bootstrap.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- WorkspaceUuid is not defined
- Accounts URL or token is not defined
- Accounts URL or token is not defined
- Accounts URL or token is not defined
- Missing env variables: ${missingEnv.join(', ')}
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/3ecbef99dd41bc9f.
Report an issue: GitHub.