knative / knative/eventing

AWS S3 IntegrationSource emits static CloudEvent `subject` and `datacontenttype`

Open
#9,163 1 comment 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
Go
Stars
1.6k
Forks
631
Avg merge
2d 1h
Merged PRs (30d)
6

Description

**Description:**

The AWS S3 IntegrationSource emits CloudEvents with a static `subject` and `datacontenttype`, regardless of the S3 object being processed.

**Expected Behavior:**

The generated CloudEvent should reflect metadata from the S3 object.

For example, when processing an object:

`eventtest/hello.txt`

uploaded with:

`Content-Type: text/plain`

the emitted CloudEvent should contain metadata derived from the object, such as:

`subject: eventtest/hello.txt`
`datacontenttype: text/plain`

(or another object-key-based subject value).

**Actual Behavior**

Every emitted event contains:

`subject: aws-s3-source`
`datacontenttype: application/json`

regardless of S3 object key, S3 object content type, Payload contents

Example received event:

```
specversion: 1.0
type: dev.knative.eventing.aws-s3
source: dev.knative.eventing.aws-s3-source
subject: aws-s3-source
datacontenttype: application/json
```

Payload:

`hello world`

**Reproduction**

Create an S3 IntegrationSource that reads from an S3 bucket and delivers events to a Knative Service sink.
Upload a file with an explicit content type:
```
echo "hello world" > hello.txt

aws s3 cp hello.txt s3:///eventtest/hello.txt \
--content-type text/plain
```
Verify the object metadata:
```
aws s3api head-object \
--bucket \
--key eventtest/hello.txt
```

Result:

```
{
"ContentType": "text/plain"
}
```
Observe the event received by the sink.

Observed Event:

```
specversion: 1.0
type: dev.knative.eventing.aws-s3
source: dev.knative.eventing.aws-s3-source
subject: aws-s3-source
datacontenttype: application/json
```

Payload:

`hello world`

With this consumers cannot:

**Identify which S3 object generated an event from CloudEvent metadata.
Filter or route events based on object keys.
Reliably determine the payload format from datacontenttype.**

This is particularly problematic when processing a mix of text, JSON, compressed, and binary objects.

Contributor guide

Open the contributing guide

Research direction

Start with the AWS S3 IntegrationSource implementation and the code that constructs its CloudEvent metadata. Reproduce the issue with an object key and explicit Content-Type as described, then verify that emitted subject and datacontenttype reflect the S3 object rather than static values.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
backend-api-design, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.