{"record":{"id":"a361af500a7710e0","repo":"risingwavelabs/risingwave","slug":"unsupported-webhook-payload-encoding-encode","errorCode":null,"errorMessage":"unsupported webhook payload encoding `{encode}`","messagePattern":"unsupported webhook payload encoding `(.+?)`","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"src/frontend/src/webhook/payload.rs","lineNumber":90,"sourceCode":"            anyhow!(e).context(\"failed to decode webhook JSON payload\"),\n            StatusCode::UNPROCESSABLE_ENTITY,\n        )\n    })\n}\n\nfn json_properties_from_headers(headers: &HeaderMap) -> Result<JsonProperties> {\n    let format = header_value(headers, WEBHOOK_FORMAT_HEADER)?.unwrap_or_else(|| \"plain\".into());\n    if !format.eq_ignore_ascii_case(\"plain\") {\n        return Err(err(\n            anyhow!(\"unsupported webhook payload format `{format}`\"),\n            StatusCode::BAD_REQUEST,\n        ));\n    }\n\n    let encode = header_value(headers, WEBHOOK_ENCODE_HEADER)?.unwrap_or_else(|| \"json\".into());\n    if !encode.eq_ignore_ascii_case(\"json\") {\n        return Err(err(\n            anyhow!(\"unsupported webhook payload encoding `{encode}`\"),\n            StatusCode::BAD_REQUEST,\n        ));\n    }\n\n    let timestamp_handling =\n        parse_timestamp_handling(headers, WEBHOOK_JSON_TIMESTAMP_HANDLING_HEADER)?;\n    let timestamptz_handling =\n        parse_timestamptz_handling(headers, WEBHOOK_JSON_TIMESTAMPTZ_HANDLING_HEADER)?;\n    let time_handling = parse_time_handling(headers, WEBHOOK_JSON_TIME_HANDLING_HEADER)?;\n    let bigint_unsigned_handling =\n        parse_bigint_unsigned_handling(headers, WEBHOOK_JSON_BIGINT_UNSIGNED_HANDLING_HEADER)?;\n    let handle_toast_columns =\n        parse_bool_header(headers, WEBHOOK_JSON_HANDLE_TOAST_COLUMNS_HEADER)?.unwrap_or(false);\n\n    Ok(JsonProperties {\n        use_schema_registry: false,\n        timestamp_handling,\n        timestamptz_handling,","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/webhook/payload.rs#L72-L108","documentation":"The `x-rw-webhook-encode` header specified an encoding other than `json`. Only JSON encoding is accepted for webhook payloads, so any other value is rejected with HTTP 400 BAD_REQUEST at configuration parsing time.","triggerScenarios":"POST with header `x-rw-webhook-encode: base64`, `gzip`, or any non-`json` value failing the case-insensitive check.","commonSituations":"Producers send gzip/base64-encoded bodies and set the encode header accordingly, expecting server-side decoding; an SDK emits a default encode header value from another product; client-side compression configuration leaks into the header.","solutions":["Send the header value as `json` (or drop the header; `json` is the default).","Pre-decode on the client: send raw JSON bytes, not base64/gzip payloads (HTTP-level compression is handled by the service's own compression layer).","Fix producer SDK defaults that inject foreign encode values.","If compression is needed, use standard `Content-Encoding` instead of the webhook encode header.","Trim whitespace and check for near-misses like `jsonl`."],"exampleFix":"// before\ncurl -H 'x-rw-webhook-encode: base64' --data-binary @body.b64 $URL\n// after\ncurl -H 'x-rw-webhook-encode: json' -H 'content-type: application/json' -d '{\"a\":1}' $URL","handlingStrategy":"validation","validationCode":"const SUPPORTED_ENCODES = ['json'];\nconst enc = headers['x-rw-webhook-encode'];\nif (enc && !SUPPORTED_ENCODES.includes(String(enc).toLowerCase().trim()))\n  throw new Error(`unsupported webhook encode: ${enc} (only 'json')`);","typeGuard":"const isSupportedEncode = (v) => typeof v === 'string' && v.trim().toLowerCase() === 'json';","tryCatchPattern":"if (!isSupportedEncode(headers['x-rw-webhook-encode'] ?? 'json'))\n  throw new Error('unsupported webhook payload encoding');\nconst res = await fetch(url, { method: 'POST', headers, body });","preventionTips":["Never base64/gzip the JSON body yourself; send raw JSON","Use standard Content-Encoding for compression, not webhook headers","Validate header values in the producer before deploy","Trim whitespace from header values"],"tags":["webhook","http-header","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}