Skip to content

Error when issuing a KMS sign request. #58

Closed
@mickeyr

Description

@mickeyr

I am trying to issue a KMS sign request but I am unable get it to work. The request looks like so

  local sign_response, sign_error = kms:sign({
    KeyId = conf.signing_kms_key_id,
    Message = table.concat(jwt_contents, "."),
    SigningAlgorithm = signing_algorithm,
    MessageType = "RAW",
  })

The error returned is as follows

[kong] init.lua:359 [capabilities] /usr/local/share/lua/5.1/resty/aws/request/build.lua:213: raw body set while parameters need to be encoded in body, client: 172.21.0.1, server: kong, request: "GET /debug HTTP/1.1", host: "localhost:8000"

As far as I can tell, the problem is because Message parameter has the shape of PlainTextType which has a type of blob.

The build_request function checks the type and sets the body to the value of message, because of the type of "blob" here. The other parameters are added to the body_tbl here to be encoded as json.

The assert found here then fails because there's a value in the body & parameters to still be serialized as json.

Is there some other way to encode these parameters so it works? or am I off base on what seems to be the issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions