Skip to content

paws.common > 0.8.5 breaks dynamodb updates to numeric values inside "map" attributes #959

@dleopold

Description

@dleopold

I recently migrated a project to a new system and updated packages, including paws. Previously working functions carrying out DynamoDB updates are now failing when updating a numeric value inside a map attribute. For example:

paws.database::dynamodb()$update_item(
    Key = list(
      pk = list(S = pk),
      sk = list(S = sk)
    ),
    ExpressionAttributeValues = list(
      `:v1` = list(
        M = list(
          numeric_attribute = list(N = 123)
        )
      ) 
    ),
    UpdateExpression = "SET test_attribute = :v1",
    TableName = "my-table"
  )

will fail with ! com.amazon.coral.service (HTTP 400). NUMBER_VALUE cannot be converted to String
Providing the number to a string allows a successful update, but should not be necessary and was not needed before:

 ExpressionAttributeValues = list(
      `:v1` = list(
        M = list(
          numeric_attribute = list(N = "123")
        )
      ) 
    )

the issue does not apply to updates of numeric attributes that are not inside map attributes. For example, this works:

paws.database::dynamodb()$update_item(
    Key = list(
      pk = list(S = pk),
      sk = list(S = sk)
    ),
    ExpressionAttributeValues = list(
      `:v1` = list(N = 123)
    ),
    UpdateExpression = "SET test_attribute = :v1",
    TableName = "my-table"
  )

When debugging this problem I noticed that my migration/update advanced me to paws.common 0.8.7 (which appears to be the current version on CRAN), yet the github release is 0.8.5. Reverting to 0.8.5 fixed the issue. I also tested 0.8.6 and that version also contains the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions