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

Release/3.0.1 #394

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 3.0.1 (2025-01-23)
--------------------------
Fix GTMSS preview expired message handling

Version 3.0.0 (2024-11-06)
--------------------------
Ensure all timestamps used in reporting are UTC
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ The AWS-specific distribution contains everything, including the Kinesis source,

To comply with the [Amazon Software License](https://github.com/twitchscience/kinsumer/blob/master/LICENSE), you may only use this distribution of Snowbridge _“with the web services, computing platforms or applications provided by Amazon.com, Inc. or its affiliates, including Amazon Web Services, Inc.”_

[release-image]: http://img.shields.io/badge/golang-3.0.0-6ad7e5.svg?style=flat
[release-image]: http://img.shields.io/badge/golang-3.0.1-6ad7e5.svg?style=flat
[releases]: https://github.com/snowplow/snowbridge/releases/
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.0.1
2 changes: 1 addition & 1 deletion cmd/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package cmd

const (
// AppVersion is the current version of the app
AppVersion = "3.0.0"
AppVersion = "3.0.1"

// AppName is the name of the application to use in logging / places that require the artifact
AppName = "snowbridge"
Expand Down
23 changes: 12 additions & 11 deletions pkg/transform/snowplow_gtmss_preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,26 @@ func gtmssPreviewTransformation(ctx, property, headerKey string, expiry time.Dur
return nil, nil, message, nil
}

tstamp, err := parsedEvent.GetValue("collector_tstamp")
headerVal, err := extractHeaderValue(parsedEvent, ctx, property)
if err != nil {
message.SetError(err)
return nil, nil, message, nil
}

if collectorTstamp, ok := tstamp.(time.Time); ok {
if time.Now().UTC().After(collectorTstamp.Add(expiry)) {
message.SetError(errors.New("Message has expired"))
if headerVal != nil {
tstamp, err := parsedEvent.GetValue("collector_tstamp")
if err != nil {
message.SetError(err)
return nil, nil, message, nil
}
}

headerVal, err := extractHeaderValue(parsedEvent, ctx, property)
if err != nil {
message.SetError(err)
return nil, nil, message, nil
}
if headerVal != nil {
if collectorTstamp, ok := tstamp.(time.Time); ok {
if time.Now().UTC().After(collectorTstamp.Add(expiry)) {
message.SetError(errors.New("Message has expired"))
return nil, nil, message, nil
}
}

if message.HTTPHeaders == nil {
message.HTTPHeaders = make(map[string]string)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/transform/snowplow_gtmss_preview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestGTMSSPreview(t *testing.T) {
Ctx: "contexts_com_google_tag-manager_server-side_preview_mode_1",
Property: "x-gtm-server-preview",
HeaderKey: "x-gtm-server-preview",
Expiry: fiftyYears,
Expiry: 1 * time.Hour,
InputMsg: &models.Message{
Data: spTsvNoGtmss,
PartitionKey: "pk",
Expand Down
Loading