Skip to content

CloudWatch emulation doesn't speak rpc-v2-cbor — current aws-sdk-go-v2 clients fail to deserialize responses #785

Closed

Description

@scttfrdmn

Summary

Substrate's emulated CloudWatch does not implement the Smithy RPC v2 CBOR protocol (smithy-rpc-v2-cbor) that current aws-sdk-go-v2 CloudWatch clients use. A PutMetricData / ListMetrics call against substrate now fails client-side with:

operation error CloudWatch: PutMetricData, https response error StatusCode: 200,
deserialization failed, expected map for struct, got major type 1

CBOR "major type 1" is a negative integer; the byte 0x3c (<) decodes as major type 1 — i.e. the client (expecting CBOR) received a legacy Query/XML-style body it can't decode.

Evidence it's a protocol mismatch, not a client bug

Against real AWS CloudWatch, the same SDK works. The request is:

POST /service/GraniteServiceVersion20100801/operation/PutMetricData
Content-Type: application/cbor
Smithy-Protocol: rpc-v2-cbor
X-Amzn-Query-Mode: true
Accept: application/cbor

and real CloudWatch replies HTTP/1.1 200 OK, Smithy-Protocol: rpc-v2-cbor, Content-Length: 0 — which the SDK deserializes cleanly (err: <nil>). Substrate returns a response the CBOR decoder rejects.

Versions

aws-sdk-go-v2 core v1.45.1 / v1.47.0, service/cloudwatch v1.69.1–v1.72.0, smithy-go v1.28.1. AWS migrated CloudWatch to rpc-v2-cbor; SDK versions from ~mid-2025 negotiate it by default (note the POST /service/.../operation/... path shape and Smithy-Protocol header).

Ask

Implement the smithy-rpc-v2-cbor protocol for the CloudWatch emulation (accept application/cbor requests at POST /service/{service}/operation/{op} and return CBOR responses, e.g. a CBOR map — an empty map for PutMetricData). Until then, consumers must point CloudWatch tests at real AWS.

Downstream

CargoShip (scttfrdmn/cargoship#459) routed its metrics integration tests at substrate's CloudWatch; they broke when the SDK moved to CBOR. We're switching those tests to real CloudWatch (skipping without creds) as the interim fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions