aws / aws/aws-lambda-go

UnmarshalTypeError on CodePipelineEventBridgeEvent

Open
#552 4 comments 0 reactions 0 assignees View on GitHub
bug type/events
Dominant language
Go
Stars
3.8k
Forks
578
Avg merge
8h 18m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**

Triggering a lambda with EventBridge CodePipeline events, i.e.:

```json
{
"detail-type": [
"CodePipeline Pipeline Execution State Change",
"CodePipeline Stage Execution State Change",
"CodePipeline Action Execution State Change"
],
"source": [
"aws.codepipeline"
]
}
```

The Lambda in question has this structure:

```go
func handler(_ context.Context, event *events.CodePipelineEventBridgeEvent) error {}
```

Upon execution, it almost immediately fails and outputs one of two errors (so far):

```
json: cannot unmarshal number 2.0 into Go struct field CodePipelineEventDetail.detail.version of type int64
```

```
json: cannot unmarshal string into Go struct field CodePipelineEventDetailType.detail.type.version of type int64
```

**Describe the solution you'd like**

I'm fairly certain I'm using the correct event type here, but I could be wrong. However, I'd like a solution to the lambda not failing immediately and the type being correct for what EventBridge is passing into the lambda.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.