Skip to content

CodeBuildEvent struct not matching CloudWatchEvents #228

@whithajess

Description

@whithajess

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.

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