{"record":{"id":"9071138d8c3b95d5","repo":"anomalyco/sst","slug":"durable-functions-require-logging-format-to-be-s","errorCode":null,"errorMessage":"Durable functions require \"logging.format\" to be set to \"json\"","messagePattern":"Durable functions require \"logging\\.format\" to be set to \"json\"","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/function.ts","lineNumber":1949,"sourceCode":"      });\n    }\n\n    function normalizeStreaming() {\n      return output(args.streaming).apply((streaming) => streaming ?? false);\n    }\n\n    function normalizeLogging() {\n      return output(args.logging).apply((logging) => {\n        if (logging === false) return undefined;\n\n        if (logging?.retention && logging?.logGroup) {\n          throw new VisibleError(\n            `Cannot set both \"logging.retention\" and \"logging.logGroup\"`,\n          );\n        }\n\n        if (args.durable && logging?.format && logging?.format != \"json\") {\n          throw new VisibleError(\n            `Durable functions require \"logging.format\" to be set to \"json\"`,\n          );\n        }\n\n        const defaultFormat = args.durable ? \"json\" : \"text\";\n\n        return {\n          logGroup: logging?.logGroup,\n          retention: logging?.retention ?? \"1 month\",\n          format: logging?.format ?? defaultFormat,\n        };\n      });\n    }\n\n    function normalizeVolume() {\n      if (!args.volume) return;\n\n      return output(args.volume).apply((volume) => ({","sourceCodeStart":1931,"sourceCodeEnd":1967,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/function.ts#L1931-L1967","documentation":"Durable functions persist structured state and therefore require JSON-formatted logs. If you explicitly set logging.format to anything other than \"json\" on a function created with `durable: true`, normalizeLogging() throws this error.","triggerScenarios":"Creating a Function with `durable: true` and `logging: { format: \"text\" }` (or any non-json format).","commonSituations":"Copy-pasting a standard function's logging config into a durable function; team-wide logging defaults forcing format: \"text\".","solutions":["Set logging: { format: \"json\" } on the durable function","Remove the explicit format so the durable default of \"json\" applies","Move `durable: false` if you genuinely need text logs"],"exampleFix":"// before\nnew sst.aws.Function(\"Fn\", { durable: true, logging: { format: \"text\" } });\n// after\nnew sst.aws.Function(\"Fn\", { durable: true, logging: { format: \"json\" } });","handlingStrategy":"validation","validationCode":"if (args.durable && args.logging && typeof args.logging === \"object\" && args.logging.format && args.logging.format !== \"json\")\n  throw new Error(\"Durable functions need logging.format = 'json'\");","typeGuard":null,"tryCatchPattern":"try {\n  new sst.aws.Function(\"Fn\", { durable: true, logging });\n} catch (e) {\n  if ((e as Error).message.includes(\"Durable functions require\")) {\n    console.error(\"Set logging.format to json or omit it\");\n  }\n  throw e;\n}","preventionTips":["Don't set logging.format explicitly on durable functions — json is the default","Exclude durable functions from any org-wide text-logging defaults"],"tags":["aws","lambda","durable","logging"],"backgroundTag":"incompatible-option-combination","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}