Skip to content

CodeBuildEvent struct not matching CloudWatchEvents #228

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

Closed
whithajess opened this issue Sep 3, 2019 · 3 comments
Closed

CodeBuildEvent struct not matching CloudWatchEvents #228

whithajess opened this issue Sep 3, 2019 · 3 comments

Comments

@whithajess
Copy link
Contributor

CloudWatchEvents seem to not match the structure of CodeBuildEvents and when performing json.Unmarshal() throws an error:

json: cannot unmarshal number 60.0 into Go struct field CodeBuildEventAdditionalInformation.timeout-in-minutes of type int64: UnmarshalTypeError
null

It looks like Test Data (with minor changes) was pulled from: AWS Build Notification Docs which may have been correct at the time but what I am observing being returned from CloudWatchEvents is 60.0 not 60

You should be able to recreate with a simple lambda listening to CloudWatchEvents with source: "aws.codebuild"

package main

import (
	"github.com/aws/aws-lambda-go/events"
	"github.com/aws/aws-lambda-go/lambda"
)

func CodeBuildNotifier(event events.CodeBuildEvent) {}

func main() {
	lambda.Start(CodeBuildNotifier)
}

This looks like it can be fixed easily by changing the types in https://github.com/aws/aws-lambda-go/blob/master/events/duration.go to float64 instead of int64 PR to follow.

@whithajess
Copy link
Contributor Author

@roberth-k I noticed you only recently put this in so you may have objections or already run up against this - any feedback would be appreciated.

@roberth-k
Copy link
Contributor

@whithajess I did come across the same issue, but only fixed it locally (roberth-k@8f0289a) and did not put up a PR at the time. The PR looks good to me.

@bmoffatt
Copy link
Collaborator

merged #229

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

3 participants