diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9e0a909a..1aafa99c98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.33.1](https://github.com/rudderlabs/rudder-server/compare/v1.33.0...v1.33.1) (2024-09-06) + + +### Bug Fixes + +* revert support for webhook headers ([#5064](https://github.com/rudderlabs/rudder-server/issues/5064)) ([56eca34](https://github.com/rudderlabs/rudder-server/commit/56eca3475e24ab9ba12624d2b4015c9d15be7249)) + ## [1.33.0](https://github.com/rudderlabs/rudder-server/compare/v1.32.0...v1.33.0) (2024-09-02) diff --git a/gateway/webhook/integration_test.go b/gateway/webhook/integration_test.go index 14cec08a29..51d0230476 100644 --- a/gateway/webhook/integration_test.go +++ b/gateway/webhook/integration_test.go @@ -293,12 +293,12 @@ func TestIntegrationWebhook(t *testing.T) { Name: "source_id", Value: sourceID, }}, - JobsLimit: 10, + JobsLimit: 1, }) - require.NoError(t, err) - return len(r.Jobs) == len(tc.Output.ErrQueue) + return err == nil && len(r.Jobs) == len(tc.Output.ErrQueue) }, time.Second, time.Millisecond*10) + require.NoError(t, err) assert.Len(t, r.Jobs, len(tc.Output.ErrQueue)) for i, p := range tc.Output.ErrQueue { errPayload, err := json.Marshal(struct { diff --git a/gateway/webhook/webhook.go b/gateway/webhook/webhook.go index ccd6fc9bbf..fd05420eaf 100644 --- a/gateway/webhook/webhook.go +++ b/gateway/webhook/webhook.go @@ -269,17 +269,6 @@ func (webhook *HandleT) batchRequests(sourceDef string, requestQ chan *webhookT) } } -func getXHeaders(req *http.Request) map[string]string { - xHeaders := make(map[string]string) - for key, values := range req.Header { - lowerCaseKey := strings.ToLower(key) - if !strings.HasPrefix(lowerCaseKey, "x-forwarded-") && strings.HasPrefix(lowerCaseKey, "x-") { - xHeaders[key] = strings.Join(values, ",") - } - } - return xHeaders -} - func prepareRequestBody(req *http.Request, sourceType string, sourceListForParsingParams []string) ([]byte, error) { defer func() { _ = req.Body.Close() @@ -303,15 +292,6 @@ func prepareRequestBody(req *http.Request, sourceType string, sourceListForParsi } } - xHeaders := getXHeaders(req) - if len(xHeaders) > 0 { - body, err = sjson.SetBytes(body, "headers", xHeaders) - if err != nil { - return nil, errors.New(response.InvalidJSON) - } - - } - return body, nil } diff --git a/gateway/webhook/webhook_test.go b/gateway/webhook/webhook_test.go index 7774f651f2..5fa7a64028 100644 --- a/gateway/webhook/webhook_test.go +++ b/gateway/webhook/webhook_test.go @@ -549,12 +549,6 @@ func TestPrepareRequestBody(t *testing.T) { sourceType: "shopify", expectedResponse: `{"key":"value","query_parameters":{}}`, }, - { - name: "Some payload with headers for shopify", - req: createRequest(requestOpts{method: http.MethodPost, target: "http://example.com", body: strings.NewReader(`{"key":"value"}`), headers: map[string]string{"X-Key": "header-value"}}), - sourceType: "shopify", - expectedResponse: `{"key":"value","query_parameters":{},"headers":{"X-Key":"header-value"}}`, - }, { name: "Some payload with query parameters for Adjust", req: createRequest(requestOpts{method: http.MethodPost, target: "http://example.com", body: strings.NewReader(`{"key1":"value1"}`), params: map[string]string{"key2": "value2"}}), diff --git a/go.mod b/go.mod index 172d07668c..5e79bebfb5 100644 --- a/go.mod +++ b/go.mod @@ -81,7 +81,7 @@ require ( github.com/rudderlabs/rudder-go-kit v0.39.2 github.com/rudderlabs/rudder-observability-kit v0.0.3 github.com/rudderlabs/rudder-schemas v0.5.1 - github.com/rudderlabs/rudder-transformer/go v0.0.0-20240903092449-3f2a5a664d32 + github.com/rudderlabs/rudder-transformer/go v0.0.0-20240906042448-f7783d8fb300 github.com/rudderlabs/sql-tunnels v0.1.7 github.com/rudderlabs/sqlconnect-go v1.9.0 github.com/samber/lo v1.47.0 diff --git a/go.sum b/go.sum index 96f7c6817b..4d50929df3 100644 --- a/go.sum +++ b/go.sum @@ -1140,8 +1140,8 @@ github.com/rudderlabs/rudder-observability-kit v0.0.3 h1:vZtuZRkGX+6rjaeKtxxFE2Y github.com/rudderlabs/rudder-observability-kit v0.0.3/go.mod h1:6UjAh3H6rkE0fFLh7z8ZGQEQbKtUkRfhWOf/OUhfqW8= github.com/rudderlabs/rudder-schemas v0.5.1 h1:g4I5wp2yA6ZWQZ1MjSNn4zby3XctG/TOgbYUW3dS4z4= github.com/rudderlabs/rudder-schemas v0.5.1/go.mod h1:JoDTB9nCDXwRz+G+aYwP3Fj42HLssKARxsFFm+qqgb4= -github.com/rudderlabs/rudder-transformer/go v0.0.0-20240903092449-3f2a5a664d32 h1:hsvbOvwfA8wr9GjNBWuh3lZnpqMgIzLU7HNESB87wSg= -github.com/rudderlabs/rudder-transformer/go v0.0.0-20240903092449-3f2a5a664d32/go.mod h1:3NGitPz4pYRRZ6Xt09S+8hb0tHK/9pZcKJ3OgOTaSmE= +github.com/rudderlabs/rudder-transformer/go v0.0.0-20240906042448-f7783d8fb300 h1:SmOLUqSCCcYs8QXYdZlHXCSCw77xhQ6qjNBsSA3bDKI= +github.com/rudderlabs/rudder-transformer/go v0.0.0-20240906042448-f7783d8fb300/go.mod h1:3NGitPz4pYRRZ6Xt09S+8hb0tHK/9pZcKJ3OgOTaSmE= github.com/rudderlabs/sql-tunnels v0.1.7 h1:wDCRl6zY4M5gfWazf7XkSTGQS3yjBzUiUgEMBIfHNDA= github.com/rudderlabs/sql-tunnels v0.1.7/go.mod h1:5f7+YL49JHYgteP4rAgqKnr4K2OadB0oIpUS+Tt3sPM= github.com/rudderlabs/sqlconnect-go v1.9.0 h1:icLgqvVQ15Vh+oP7epA0b0yK6sIzxRVwPlRzOoDNVRA=