Skip to content

SSM plugin: SendCommand returns DateTime as JSON string but Go SDK expects JSON Number — deserialization failure #261

Closed

Description

@scttfrdmn

Bug

SendCommand fails with a deserialization error when called via the AWS Go SDK v2:

operation error SSM: SendCommand, https response error StatusCode: 200, RequestID: ,
deserialization failed, failed to decode response body,
expected DateTime to be a JSON Number, got string instead

Root Cause

The SSM SDK uses application/x-amz-json-1.1 (JSON protocol), so the response format is correct — unlike #260 (IAM). However, the SSM plugin serializes timestamp fields as RFC3339 strings (e.g. "2026-04-02T00:00:00Z") when the SDK's JSON protocol for SSM requires timestamps as Unix epoch seconds (float64).

The Go SDK's smithy-go deserializer for DateTime fields in JSON protocol services expects a number like 1743552000.0, not an ISO 8601 string.

Reproduction

ts := substrate.StartTestServer(t)
// ... configure aws.Config pointing to ts.URL ...
ssmClient := ssm.NewFromConfig(cfg)

_, err := ssmClient.SendCommand(ctx, &ssm.SendCommandInput{
    DocumentName: aws.String("AWS-RunShellScript"),
    InstanceIds:  []string{"i-test12345678"},
    Parameters:   map[string][]string{"commands": {"echo hello"}},
})
// err = "deserialization failed, failed to decode response body,
//        expected DateTime to be a JSON Number, got string instead"

Fix

In ssm_plugin.go, serialize all time.Time fields as Unix epoch float64 instead of RFC3339 strings when building JSON responses:

// Instead of:
"RequestedDateTime": time.Now().UTC().Format(time.RFC3339),

// Use:
"RequestedDateTime": float64(time.Now().Unix()),

Affected fields in SendCommand response: RequestedDateTime on the Command object.
Affected fields in GetCommandInvocation response: ExecutionStartDateTime, ExecutionElapsedTime, ExecutionEndDateTime.

Scope

Any SSM JSON response field typed as timestamp in the SSM API model will have this issue. Worth auditing all timestamp fields in ssm_plugin.go responses.

This is distinct from #260 (IAM protocol mismatch) — SSM correctly uses JSON protocol but uses the wrong timestamp encoding.

Discovered Via

Integration testing Prism against Substrate in pkg/aws/substrate_integration_test.go (TestSubstrateSSMRunCommand).

Activity

  1. added
    type: bug
    and removed on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions