{"record":{"id":"7a5b0a5f756255da","repo":"hcengineering/platform","slug":"please-provide-email-service-url","errorCode":null,"errorMessage":"Please provide email service url","messagePattern":"Please provide email service url","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/account/src/utils.ts","lineNumber":1437,"sourceCode":"    return invite\n  }\n\n  return await db.invite.findOne({ migratedFrom: id })\n}\n\nexport async function getSocialIdByKey (db: AccountDB, socialKey: string): Promise<SocialId | null> {\n  return await db.socialId.findOne({ key: socialKey })\n}\n\nexport async function getEmailSocialId (db: AccountDB, email: string): Promise<SocialId | null> {\n  return await db.socialId.findOne({ type: SocialIdType.EMAIL, value: email })\n}\n\nexport function getMailUrl (): { mailURL: string, mailAuth: string | undefined } {\n  const mailURL = getMetadata(accountPlugin.metadata.MAIL_URL)\n\n  if (mailURL === undefined || mailURL === '') {\n    throw new Error('Please provide email service url')\n  }\n  const mailAuth = getMetadata(accountPlugin.metadata.MAIL_AUTH_TOKEN)\n\n  return { mailURL, mailAuth }\n}\n\nexport function getFrontUrl (branding: Branding | null): string {\n  const front = branding?.front ?? getMetadata(accountPlugin.metadata.FrontURL)\n\n  if (front === undefined || front === '') {\n    throw new Error('Please provide front url')\n  }\n\n  return front\n}\n\nexport async function updateArchiveInfo (\n  ctx: MeasureContext,","sourceCodeStart":1419,"sourceCodeEnd":1455,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/server/account/src/utils.ts#L1419-L1455","documentation":"getMailUrl reads the MAIL_URL metadata and throws a plain Error('Please provide email service url') when it is undefined or empty. It is the synchronous accessor variant used by mail-sending helpers, guaranteeing callers never proceed without a configured mail endpoint.","triggerScenarios":"Any code path that calls getMailUrl() on an account server where metadata accountPlugin.metadata.MAIL_URL is missing or empty.","commonSituations":"Self-hosted instance without the mail service URL configured; env var dropped during redeployment or secret rotation; running only part of the platform locally where mail was never set up.","solutions":["Set MAIL_URL in the account service configuration and restart.","Validate deployment values (helm values/secret) contain MAIL_URL before rollout.","For local dev, point MAIL_URL at a local SMTP catcher or mock mailer.","Add a startup check that fails fast if MAIL_URL is absent."],"exampleFix":"// env/config\n// before\nMAIL_URL=\n// after\nMAIL_URL=smtp://user:pass@smtp.example.com:587","handlingStrategy":"validation","validationCode":"if (!process.env.MAIL_URL) {\n  throw new Error('MAIL_URL is required for mail sending')\n}","typeGuard":null,"tryCatchPattern":"try {\n  const { mailURL, mailAuth } = getMailUrl()\n  // send mail\n} catch (err) {\n  if (err instanceof Error && err.message.includes('email service url')) {\n    // fail fast with a config-setup message pointing to MAIL_URL docs\n  } else throw err\n}","preventionTips":["Set MAIL_URL in all environments, including local dev (use mailcatcher).","Validate required env at process boot, not at first send.","Lint deployment templates for required variables.","Alert on first occurrence since it indicates config drift."],"tags":["configuration","email","missing-env-var"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}