Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetPipelineStateResponse doesn't serialize #517

Closed
magthe opened this issue Feb 9, 2019 · 3 comments
Closed

GetPipelineStateResponse doesn't serialize #517

magthe opened this issue Feb 9, 2019 · 3 comments

Comments

@magthe
Copy link

magthe commented Feb 9, 2019

I'm trying to move the scripts I'm using daily from calls-to-awscli-wrapped-in-Python to Haskell using Amazonka. So far it's been going smoothly, but now I've hit a possible bug.

I need to use getPipelineState to get to the token of a Manual-Approval stage in the pipeline, but it's failing when serializing the response:

[SerializeError] {
  service = CodePipeline
  status  = 200 OK
  message = Error in $[0].actionStates[0].currentRevision: key "revisionChangeId" not present
...

When I run aws codepiline get-pipeline-state --name <name> I can indeed see that actionStates[0] has a currentRevision, but that doesn't have a field revisionChangeId:

{
  "actionName": "S3",
  "currentRevision": {
    "revisionId": "zj1ZOqcunNYhvLTV3qUvqoLBUacInU6s"
  },
  "latestExecution": {
    "status": "Succeeded",
    "summary": "Amazon S3 version id: zj1ZOqcunNYhvLTV3qUvqoLBUacInU6s",
    "lastStatusChange": 1549696799.982,
    "externalExecutionId": "zj1ZOqcunNYhvLTV3qUvqoLBUacInU6s"
  },
  "entityUrl": "https://console.aws.amazon.com/s3/home?#"
}

AFAICS this doesn't really match the documentation of the response that I found, but that might not mean much 🤷‍♂️

I'm guessing that a possible fix would be to put in a few Maybes in the definition of ActionRevision. However, I'm new to Amazonka and I'm not sure where to start in order to make such a change (AFAIU the code in question is autogenerated) so hints and pointers would be most welcome.

@AlexeyRaga
Copy link

AlexeyRaga commented Feb 9, 2019

I've seen this before in other AWS services and it rings the bell.
This is AWS's fault. Whether it is helps or not is another question, but their own documentation says:

revisionChangeId
    The unique identifier of the change that set the state to this revision, for example a deployment ID or timestamp.
    Type: String
    Length Constraints: Minimum length of 1. Maximum length of 100.
    Required: Yes

Notice the Required: Yes property. By not including it into the response they violate their own contract.

I believe that Amazonka's contracts are largely generated from the documentation (and it indeed generates Maybe for Required: No). But Amazonka excepts the contract to be honoured.
Other services, like Terraform also rely on these docs/contracts, and this is where I saw a very similar "required" field issue before.

I don't know a good way of fixing it TBH. Definitely this bug should be raised with AWS support, but it may take time for them to fix an issue (or documentation), and the for Amazonka to reflect the change...

@magthe
Copy link
Author

magthe commented Feb 9, 2019

It doesn't surprise me that the blame falls on AWS, however that also makes me less hopeful for a proper fix arriving soon :(

With the size of the AWS API this sort of errors in the specification vs the implementation must have popped up before. Is there an established way to deal with it, ideally something better/quicker than "wait for Amazon to get their house in order"?

Alternatively, is there a way to "intercept" the response, to pick it up before de-serialisation?
(That'd give me an excellent reason to take a look at lens-aeson :) )

@magthe
Copy link
Author

magthe commented Feb 9, 2019

Oh, and I reported it via the feedback link on the ActionRevision doc page.

@magthe magthe closed this as completed Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants