Repository navigation
Release for LeanPlum & Generic Webhook - #94
Conversation
Customerio
braze append traits with track events & also tests
Co-authored-by: dhawal-rudder <[email protected]>
* add collectContext * remove unsupported methods * field names refactor * changes for intercom api v2 * Reverted to API version v1.4 and fixed user_id issue in for identify Co-authored-by: dhawal-rudder <[email protected]> Co-authored-by: Arnab <[email protected]>
* initial commit for leanplum transformation * added code for advance API call * added code for identify and track * Prettier formatting changed context.traits is passed to setUserAttributes * sending anonymousId as userId for track and page * Fixed prettier errors * Changes for LeanPlum cloud mode * split all config json files into required and optional fields * added all fields supported by leanplum * Added config file for start API call * Updated Config JSON files for unified structure * added code to set required and optional values * Finalized Leanplum * Fixed userId and time Co-authored-by: arnab <[email protected]>
* Minor optimizations for warehouse transformer * custom fields in traits & Todo -map all sg traits * test file fix salesforce * Add original timestamp to transformed events in warehouse * salesforce full SEG identify fields mapping * comment removal * output format changed in case of exception * changes for intercom api v2 (#81) Co-authored-by: dhawal-rudder <[email protected]> * Dest intercom (#82) * add collectContext * remove unsupported methods * field names refactor * changes for intercom api v2 * Reverted to API version v1.4 and fixed user_id issue in for identify Co-authored-by: dhawal-rudder <[email protected]> Co-authored-by: Arnab <[email protected]> * Fixed conflict error * Fixed user endpoint for intercom * Add output field inside user transformation (#83) * Add received_at to users table in warehouse * transformer version changed to v0.1.4 * changes for webhook dest and testcases * ip fix and test case update * implement review comments * making a release * bump version * Destination leanplum (#88) * initial commit for leanplum transformation * added code for advance API call * added code for identify and track * Prettier formatting changed context.traits is passed to setUserAttributes * sending anonymousId as userId for track and page * Fixed prettier errors * Changes for LeanPlum cloud mode * split all config json files into required and optional fields * added all fields supported by leanplum * Added config file for start API call * Updated Config JSON files for unified structure * added code to set required and optional values * Finalized Leanplum * Fixed userId and time Co-authored-by: arnab <[email protected]> * changes for webhook dest and testcases * Fixed lint, from let to const * Added test cases and handled null headers and invalid webhook URL scenario Co-authored-by: Srikanth <[email protected]> Co-authored-by: Rajashekar Varkala <[email protected]> Co-authored-by: lokey <[email protected]> Co-authored-by: Rajashekar Varkala <[email protected]> Co-authored-by: varkalablr <[email protected]> Co-authored-by: Chandra shekar Varkala <[email protected]> Co-authored-by: Arnab <[email protected]> Co-authored-by: dhawal-rudder <[email protected]> Co-authored-by: Sampath <[email protected]> Co-authored-by: arnab <[email protected]>
| ); | ||
| //console.log(rawPayload); | ||
|
|
||
| if (userId) { |
There was a problem hiding this comment.
Let's move this check to the beginning of the if block. As a practice, whenever we can return from a function those checks should be at the top.
| message.userId && message.userId != "" ? message.userId : undefined; | ||
|
|
||
| const response = defaultRequestConfig(); | ||
| response.userId = message.userId ? message.userId : message.anonymousId; |
There was a problem hiding this comment.
response.userId = message.userId || message.anonymousId.
| }; | ||
|
|
||
| return response; | ||
| } else { |
There was a problem hiding this comment.
Else can be skipped. Anyways, it's better to return error in the if.
I like this pattern.
There was a problem hiding this comment.
The post is really good. I'd try to enforce this pattern going forward
| case EventType.SCREEN: | ||
| evType = "event"; | ||
| evName = | ||
| "Viewed " + message.name |
There was a problem hiding this comment.
Can we put the part after Viewed in ().
Also since JS has no type, we could merge some ternary operator to || statements.
| destination | ||
| ); | ||
| // console.log(payload); | ||
| const url = ENDPOINT + "?action=start"; |
There was a problem hiding this comment.
Let's send as array of two events back to router. We can remove the RETRY logic,
| function process(event) { | ||
| const { message, destination } = event; | ||
| const response = defaultRequestConfig(); | ||
| if (destination.Config.webhookUrl && isURL(destination.Config.webhookUrl)) { |
There was a problem hiding this comment.
Regex checks are generally costly. Let's move this check to config-backend/webapp and assume this is a valid URL.
There was a problem hiding this comment.
Removed the regex check
|
|
||
| response.userId = message.userId ? message.userId : message.anonymousId; | ||
| response.body.JSON = { ...message }; | ||
| if (!response.statusCode) { |
There was a problem hiding this comment.
statusCode is not needed. Removed it
| "Content-Type": "application/json" | ||
| }; | ||
|
|
||
| const configHeaders = destination.Config.header; |
There was a problem hiding this comment.
Should we change the config-backend param to headers as well (instead of header)
There was a problem hiding this comment.
Updated both control-plane and here
| const configHeaders = destination.Config.header; | ||
| if (configHeaders) { | ||
| configHeaders.forEach(header => { | ||
| response.headers[header.from] = header.to; |
There was a problem hiding this comment.
Shouldn't this be header.name and header.value?
There was a problem hiding this comment.
Didn't get you completely. But I think we are not adding extra keys name and value. Kept it as it is
There was a problem hiding this comment.
Ideally these fields should be named header.name and header.value.
For a header, from and to is not the right convention.
There was a problem hiding this comment.
Yes. But from and to is coming from our config-backend response.
| response.endpoint = destination.Config.webhookUrl; | ||
| response.method = defaultPostRequestConfig.requestMethod; | ||
| // add content-type by default as our payload is json | ||
| response.headers = { |
There was a problem hiding this comment.
Our server's network.go support FORM body too. Do we want to restrict webhook only for JSON.
That is good infact, when someone asks we can enable support for FORM.
|
@SumanthPuram Review comments are taken care of. Please check. |
| "Viewed " + message.name | ||
| ? message.name | ||
| : message.properties.name + " Screen"; | ||
| evName = "Viewed " + message.name || message.properties.name + " Screen"; |
There was a problem hiding this comment.
"Viewed " + (message.name || message.properties.name) + " Screen"
For better readability?
| @@ -96,42 +92,7 @@ function responseBuilderSimple(message, category, destination) { | |||
| } | |||
|
|
|||
| async function startSession(message, destination) { | |||
There was a problem hiding this comment.
This not an async function anymore. We can remove async and the corresponding await.
| // all event types except idetify requires startSession | ||
| if (messageType !== EventType.IDENTIFY) { | ||
| await startSession(message, destination); | ||
| respList = [await startSession(message, destination)]; |
* bug fix * Few code cleanups Co-authored-by: arnab <[email protected]>
## What are the changes introduced in this PR? Mixpanel /import emits GZIP without a capability handshake. Removed the unused shared check and constant, batching-only metadata plumbing, and obsolete test headers. Updated three headerless router expectations without changing their JSON payloads. ## What is the related Linear task? Resolves INT-6925 ## Please explain the objectives of your changes below This change follows the env-flag rollout work in INT-6924 and INT-6926. Removing the header from rudder-server remains a coordinated follow-up. ### Any changes to existing capabilities/behaviour, mention the reason & what are the changes ? Headerless /import requests now receive GZIP. In production the server already advertises gzip support unconditionally. /engage and /groups retain their workspace env-flag gates. ### Any new dependencies introduced with this change? None. ### Any new generic utility introduced or modified. Please explain the changes. Removed the unused IsGzipSupported utility and FEATURE_GZIP_SUPPORT constant; no utility was added. ### Any technical or performance related pointers to consider with the change? Router request metadata remains available to single-event error handling. The secret-path manifest passed byte comparison and was not changed. <hr> ### Developer checklist - [x] My code follows the style guidelines of this project - [x] No breaking changes are being introduced for the stated production server baseline - [x] All related docs linked with the PR? HLD §4.2 and §10 item 4, rudder-specs #94 - [x] All changes manually tested? Validated with automated unit and component tests - [x] Any documentation changes needed with this change? No - [x] Is the PR limited to 10 file changes? Yes, six - [x] Is the PR limited to one linear task? Yes - [x] Are relevant unit and component test-cases added in new readability format? Updated existing coverage and fixtures ### Validation - `npm run lint` — passed. - `npm test -- --testPathPattern="src/v0/destinations/mp/util.test.js" --no-coverage` — 57 passed. - `npm run test:ts -- component --destination=mp` — 83 passed. - `./node_modules/.bin/tsc --noEmit -p tsconfig.json` and `-p tsconfig.test.json` — passed. - Full `npm run check:secret-paths` with integrations-config definitions — passed byte comparison. - `git diff --check` — passed; obsolete-symbol search across `src` and `test` — no matches. - Simplify pass: combined duplicate constant imports; no other worthwhile findings. An additional broad `mp` Jest-pattern run timed out after five minutes; the focused Mixpanel unit suite passed. - Local integration verification: skipped because rudder-transformer uses a sha-pinned service image and its edited source cannot be run by mini in this sandbox. ##⚠️ Known Issues - The broader `mp` Jest-pattern run timed out after five minutes; the focused Mixpanel unit suite and 83 component cases passed. - The `X-Feature-Gzip-Support` header remains in rudder-server pending coordination with that team. - The transformer source change was not exercised against a live mini stack because this service cannot be source-built in this sandbox. ### Reviewer checklist - [ ] Is the type of change in the PR title appropriate as per the changes? - [ ] Verified that there are no credentials or confidential data exposed with the changes. Co-authored-by: tech-infra-rudderstack <[email protected]>
This change is