anomalyco/sst · error · VisibleError
Durable functions require "logging.format" to be set to "jso
Error message
Durable functions require "logging.format" to be set to "json"
What it means
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.
Source
Thrown at platform/src/components/aws/function.ts:1949
});
}
function normalizeStreaming() {
return output(args.streaming).apply((streaming) => streaming ?? false);
}
function normalizeLogging() {
return output(args.logging).apply((logging) => {
if (logging === false) return undefined;
if (logging?.retention && logging?.logGroup) {
throw new VisibleError(
`Cannot set both "logging.retention" and "logging.logGroup"`,
);
}
if (args.durable && logging?.format && logging?.format != "json") {
throw new VisibleError(
`Durable functions require "logging.format" to be set to "json"`,
);
}
const defaultFormat = args.durable ? "json" : "text";
return {
logGroup: logging?.logGroup,
retention: logging?.retention ?? "1 month",
format: logging?.format ?? defaultFormat,
};
});
}
function normalizeVolume() {
if (!args.volume) return;
return output(args.volume).apply((volume) => ({View on GitHub (pinned to a0bd20f762)
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
Example fix
// before
new sst.aws.Function("Fn", { durable: true, logging: { format: "text" } });
// after
new sst.aws.Function("Fn", { durable: true, logging: { format: "json" } }); Defensive patterns
Strategy: validation
Validate before calling
if (args.durable && args.logging && typeof args.logging === "object" && args.logging.format && args.logging.format !== "json")
throw new Error("Durable functions need logging.format = 'json'"); Try / catch
try {
new sst.aws.Function("Fn", { durable: true, logging });
} catch (e) {
if ((e as Error).message.includes("Durable functions require")) {
console.error("Set logging.format to json or omit it");
}
throw e;
} Prevention
- Don't set logging.format explicitly on durable functions — json is the default
- Exclude durable functions from any org-wide text-logging defaults
When it happens
Trigger: Creating a Function with `durable: true` and `logging: { format: "text" }` (or any non-json format).
Common situations: Copy-pasting a standard function's logging config into a durable function; team-wide logging defaults forcing format: "text".
Related errors
- Cannot set both "logging.retention" and "logging.logGroup"
- You must provide a KMS key via `kmsKey` when configuring `cu
- Copy destination path "${to}" must be relative
- The "vpc.subnets" property has been renamed to "vpc.privateS
- result.errors.join("\n")
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/9071138d8c3b95d5.
Report an issue: GitHub.