Skip to content

Conversation

@mdkhan-tw
Copy link
Contributor

@mdkhan-tw mdkhan-tw commented Nov 5, 2025

  1. Adding send action for kinesis destination
  2. Added aws-kinesis library
  3. Added unit tests

Testing

  1. Added unit tests
  2. Performed end to end testing using action tester, debug logs
arn:aws:iam::000000000000:role/mdkhan-assume-role-for-kinesis-destination mdkhan-external-id
✅ Sent 1 records to Kinesis
Response: {
  '$metadata': {
    httpStatusCode: 200,
    requestId: 'cea4d02d-ecb2-9611-af27-5dd931044082',
    extendedRequestId: 'VEqlAQ6YZHE0mp6OsO+Br2ohbOdzelmuVZsYYeSOox3mm3D2GPW9Nde38lZLkvug0nDzalU9LkALmPC3XJGWmTPyMNGHDto/',
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  FailedRecordCount: 0,
  Records: [
    {
      SequenceNumber: '49668576224122157143775420512337700422063236647695155234',
      ShardId: 'shardId-000000000002'
    }
  ]
}

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.36%. Comparing base (cf48806) to head (9bfa337).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...actions/src/destinations/aws-kinesis/send/index.ts 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3397      +/-   ##
==========================================
+ Coverage   80.33%   80.36%   +0.02%     
==========================================
  Files        1267     1485     +218     
  Lines       25246    28785    +3539     
  Branches     5185     6066     +881     
==========================================
+ Hits        20282    23133    +2851     
- Misses       4176     4844     +668     
- Partials      788      808      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

credentials: credentials
})

await client.send(command)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the AbortSignal Support similar to s3 destination?
#3381

This will help us standardize timeouts in the system as part of Flexible Request Durations
: https://docs.google.com/document/d/1snhMygiEaMJ2QwC68PjNTmNQdvUhwhqcbTVzlJY4XQA/edit?tab=t.xja93wmhydze

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo, kinesis destination is very different from S3 or SFTP destinations because in S3/SFTP destinations, we upload very large objects, where the latency will be high and there is a chance that the connection might hang. In Kinesis API call, the max records can't exceed beyond 10 MB / 500 records per call, thus the corresponding latency will be very low (in order of few seconds). I plan to add timeout by connectionTimeout and socketTimeout which is simple to implement that AbortSignal. JIRA https://twilio-engineering.atlassian.net/browse/STRATCONN-6335

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irrespective of payload sizes, the abortsignal should be implemented as it also handles centrifuge side timeouts/request cancellations, making sure all process are reliably cancelled. However, you can address this in a separate PR as a ticket for there seems to be a separate ticket for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let's take it separately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acking that abort signal will be implemented later.

Copy link
Contributor

@joe-ayoub-segment joe-ayoub-segment left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mohammed - I reviewed some of the code and left some comments. But decided to ping you to catch up in person...

Comment on lines +17 to +25
const validatePartitionKey = (partitionKey: string): void => {
if (!partitionKey) {
throw new IntegrationError(
`Partition Key is required in the payload to send data to Kinesis.`,
'PARTITION_KEY_MISSING',
400
)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function shouldn't be required. partition_key is a required field, so only payloads containing a value will be passed into the perform() and performBatch() functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo, it's better to write necessary validations than to only rely on clients. It will be helpful during local testing or traffic from other source than centrifuge (in future)

region: awsRegion,
credentials: credentials,
requestHandler: new NodeHttpHandler({
requestTimeout: KINESIS_COMMAND_TIMEOUT_MS // timeout in milliseconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct timeout value to set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

credentials: credentials
})

await client.send(command)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acking that abort signal will be implemented later.

@joe-ayoub-segment joe-ayoub-segment merged commit dc96058 into main Nov 12, 2025
22 of 24 checks passed
@joe-ayoub-segment joe-ayoub-segment deleted the STRATCONN-6277 branch November 12, 2025 10:27
@joe-ayoub-segment
Copy link
Contributor

PR deployed

@viralpickaxe
Copy link

Hi @joe-ayoub-segment it appears that this change has broken our entire segment setup as process.env is trying to be read a browser environment

@johndellavecchia
Copy link

@joe-ayoub-segment this seems to have broken our segment setup. The erroring file is in Destination/actions-shared/dist/aws-config/index.js, which is Segment's internal "Actions / Destinations" bundle.

@itsarijitray
Copy link
Contributor

Hello @viralpickaxe @johndellavecchia ,

Thank you for reporting this issue. We sincerely apologize for the disruption this change has caused to your Segment setup.

We are currently prioritizing a revert of the recent change to resolve the process.env issue occurring in the browser environment. We are working on deploying the fix as quickly as possible.

We will provide an update here once the revert is complete and the fix is live.

Thank you for your patience and understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants