{"record":{"id":"fb705244ce0715b4","repo":"mastra-ai/mastra","slug":"http-url-is-required","errorCode":null,"errorMessage":"HTTP URL is required","messagePattern":"HTTP URL is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/loggers/src/http/index.ts","lineNumber":36,"sourceCode":"}\n\nexport class HttpTransport extends LoggerTransport {\n  private url: string;\n  private method: string;\n  private headers: Record<string, string>;\n  private batchSize: number;\n  private flushInterval: number;\n  private timeout: number;\n  private retryOptions: Required<RetryOptions>;\n  private logBuffer: BaseLogMessage[];\n  private lastFlush: number;\n  private flushIntervalId: NodeJS.Timeout;\n\n  constructor(options: HttpTransportOptions) {\n    super({ objectMode: true });\n\n    if (!options.url) {\n      throw new Error('HTTP URL is required');\n    }\n\n    this.url = options.url;\n    this.method = options.method || 'POST';\n    this.headers = {\n      'Content-Type': 'application/json',\n      ...options.headers,\n    };\n    this.batchSize = options.batchSize || 100;\n    this.flushInterval = options.flushInterval || 10000;\n    this.timeout = options.timeout || 30000;\n    this.retryOptions = {\n      maxRetries: options.retryOptions?.maxRetries || 3,\n      retryDelay: options.retryOptions?.retryDelay || 1000,\n      exponentialBackoff: options.retryOptions?.exponentialBackoff || true,\n    };\n\n    this.logBuffer = [];","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/loggers/src/http/index.ts#L18-L54","documentation":"The HttpLogger transport requires a target URL; the constructor throws 'HTTP URL is required' when options.url is missing, null, or an empty string. Without a URL there is nowhere to POST log entries.","triggerScenarios":"new HttpTransport({}) or HttpTransport({ url: process.env.LOG_URL }) where the env var is unset (undefined) or empty.","commonSituations":"Missing LOG_ENDPOINT-style environment variable; options object constructed conditionally and url branch skipped; typo in option key (uri/endpoint instead of url).","solutions":["Pass a valid url option, e.g. { url: 'https://logs.example.com/collect' }.","Check the environment variable feeding options.url is set and non-empty (fail fast at startup with a clear message).","Fix the option key spelling — it must be exactly url."],"exampleFix":"// before\nconst logger = new HttpTransport({ url: process.env.LOG_URL }); // throws if unset\n// after\nif (!process.env.LOG_URL) throw new Error('LOG_URL env var must be set');\nconst logger = new HttpTransport({ url: process.env.LOG_URL, method: 'POST' });","handlingStrategy":"validation","validationCode":"function assertHttpTransportOptions(opts) {\n  if (!opts.url || !/^https?:\\/\\//.test(opts.url)) {\n    throw new Error('HttpTransport requires a valid http(s) url');\n  }\n}","typeGuard":"function hasUrl(opts) {\n  return typeof opts.url === 'string' && opts.url.length > 0;\n}","tryCatchPattern":"try {\n  const logger = new HttpTransport({ url: process.env.LOG_URL });\n} catch (e) {\n  if (e.message === 'HTTP URL is required') {\n    console.error('LOG_URL is not configured');\n  }\n  throw e;\n}","preventionTips":["Validate required env vars at process startup before wiring loggers.","Use the exact option key url (not uri/endpoint).","Add a config schema check (e.g. zod) for transport options."],"tags":["logging","configuration","http","validation"],"backgroundTag":"missing-required-option","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}