Skip to content

Conversation

@swatimodi-scout
Copy link
Contributor

Description

This PR includes two key improvements to the AWS Kinesis input binding:

  • Upgrade to vmware-go-kcl-v2
    • Updated the Kinesis consumer dependency from the legacy vmware-go-kcl to vmware-go-kcl-v2.
    • Motivation: The original library is no longer actively maintained and lacks critical bug fixes and performance improvements.
    • Changes:
      • Updated go.mod to reference github.com/vmware/vmware-go-kcl-v2.
      • Adjusted import paths and updated worker configuration to align with the new v2 APIs.
      • Verified compatibility with existing Kinesis input binding behavior through unit and integration tests.
  • Fix for nil pointer reference in Kinesis input binding
    • Resolved a bug where the binding attempted to resolve the stream ARN unconditionally, even when KinesisConsumerMode was set to SharedThroughput (default mode).
    • Issue: The binding was calling authProvider.Kinesis().Stream(...) regardless of the configured consumer mode.
    • Impact: When running in SharedThroughput mode (such as with LocalStack), this caused nil pointer errors if the stream was unavailable or uninitialized.
    • Fix: Added a conditional check so that stream ARN resolution only occurs when KinesisConsumerMode is set to ExtendedFanout.

These changes improve stability and maintainability of the Kinesis input binding, ensuring compatibility with LocalStack and future AWS SDK updates.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[3980, 3985]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Note: We expect contributors to open a corresponding documentation PR in the dapr/docs repository. As the implementer, you are the best person to document your work! Implementation PRs will not be merged until the documentation PR is opened and ready for review.

@swatimodi-scout swatimodi-scout requested review from a team as code owners October 31, 2025 10:53
Copy link
Contributor

@sicoyle sicoyle left a comment

Choose a reason for hiding this comment

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

thank you for your contribution to the Dapr project 🙌 - few comments :)

closed atomic.Bool
closeCh chan struct{}
wg sync.WaitGroup
applicationName string
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 please share some insights on why the additional field here?

Copy link
Contributor Author

@swatimodi-scout swatimodi-scout Nov 3, 2025

Choose a reason for hiding this comment

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

can you please share some insights on why the additional field here?

applicationName is required for KCL (Kinesis Client Library) worker configuration in shared throughput mode. It identifies the consumer application and is used for DynamoDB table naming and checkpointing.

Without applicationName we were facing an error.

Copy link
Member

Choose a reason for hiding this comment

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

I'd move this field next to consumerMode. And the comment is not necessary if you ask me, I'd remove it for consistency, but feel free to keep if you think it's useful :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd move this field next to consumerMode. And the comment is not necessary if you ask me, I'd remove it for consistency, but feel free to keep if you think it's useful :)

Done

Comment on lines 202 to 235
v1Creds, err := c.Credentials.Get()
if err != nil {
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we ignoring the err here? If we are updating to use v2 then can you make the v2 creds provider be the default and if err then maybe try the v1 and then err from there? but pls reference the other aws components to see the auth flow so we can ensure that we standardize on this for when using v2 sdks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why are we ignoring the err here? If we are updating to use v2 then can you make the v2 creds provider be the default and if err then maybe try the v1 and then err from there? but pls reference the other aws components to see the auth flow so we can ensure that we standardize on this for when using v2 sdks.

Done please verify this.

@acroca
Copy link
Member

acroca commented Nov 5, 2025

The git history of this PR seems odd, lots of those commits are unrelated. Do you mind cleaning it up so it only contains commits related to this change?

@swatimodi-scout swatimodi-scout force-pushed the feat/kinesis-binding-vmware-go-kcl-v2-latest branch from e6bc920 to cabcec5 Compare November 11, 2025 10:09
@swatimodi-scout
Copy link
Contributor Author

The git history of this PR seems odd, lots of those commits are unrelated. Do you mind cleaning it up so it only contains commits related to this change?

@acroca Thanks for the feedback! I’ve cleaned up the branch history — the PR now contains only the relevant commit for this change. Please let me know if anything else needs adjustment.

Signed-off-by: swatimodi-scout <[email protected]>
closed atomic.Bool
closeCh chan struct{}
wg sync.WaitGroup
applicationName string
Copy link
Member

Choose a reason for hiding this comment

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

I'd move this field next to consumerMode. And the comment is not necessary if you ask me, I'd remove it for consistency, but feel free to keep if you think it's useful :)

Comment on lines 186 to 189
/**
* If the error is not nil, do not proceed to the next step
* as it may cause a nil pointer error on stream.StreamDescription.StreamARN.
*/
Copy link
Member

Choose a reason for hiding this comment

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

I think the comment is not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the comment is not necessary

Done

kclConfig := config.NewKinesisClientLibConfigWithCredential(applicationName, stream, region, "", v2Config.Credentials)
return kclConfig
}
// Fallback to v1 credentials if v2 fails
Copy link
Member

Choose a reason for hiding this comment

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

In which cases would v2 fail, but v1 work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In which cases would v2 fail, but v1 work?

@acroca

Good question! You're right to point that out. Looking at this more carefully, the v2 fallback to v1 scenario is actually quite rare and adds unnecessary complexity.

In practice, both v1 and v2 SDKs use the same underlying credential sources (env vars, credential files, IAM roles, etc.), so if v2 fails to load credentials, v1 would likely fail for the same reason.

Since we already have validated v1 credentials from the established session, I've simplified this to directly use those credentials and convert them to v2 format for KCL compatibility. This is more reliable and removes the redundant credential resolution logic.

Updated the code to use the existing session credentials directly - much cleaner approach! 👍

swatimodi-scout and others added 3 commits November 11, 2025 17:42
Co-authored-by: Albert Callarisa <[email protected]>
Signed-off-by: swatimodi-scout <[email protected]>
Co-authored-by: Albert Callarisa <[email protected]>
Signed-off-by: swatimodi-scout <[email protected]>
Signed-off-by: swatimodi-scout <[email protected]>
Comment on lines 198 to 202
v1Creds, err := c.Credentials.Get()
if err != nil {
return nil
}
v2Creds := v2creds.NewStaticCredentialsProvider(v1Creds.AccessKeyID, v1Creds.SecretAccessKey, v1Creds.SessionToken)
Copy link
Member

Choose a reason for hiding this comment

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

It feels wrong to have both v1 and v2 living together. Can't we migrate completely to v2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It feels wrong to have both v1 and v2 living together. Can't we migrate completely to v2?

Done please review it.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this works, it's not wired up to the refresh at all.
I think it was better before, but the conversion from v1 credentials to v2 should be done in the KinesisClients.New, which is called in the refresh operations.
This way, you can convert all kinesis to v2 and only do the v1->v2 in the New right?

Copy link
Contributor

Choose a reason for hiding this comment

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

thansks @swatimodi-scout! What if you fully migrate the aws client to v2? you do not need to migrate all other components, it would be something similar to this PR that @mikeee is working on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thansks @swatimodi-scout! What if you fully migrate the aws client to v2? you do not need to migrate all other components, it would be something similar to this PR that @mikeee is working on.

@javier-aliaga Yes, that makes sense. However, we’re not migrating the entire AWS SDK version at this stage — my current change focuses only on updating vmware-go-kcl to vmware-go-kcl-v2.

Would you prefer that I continue implementing the AWS SDK v2 changes for Kinesis within this same PR, or should I move that work to a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this works, it's not wired up to the refresh at all. I think it was better before, but the conversion from v1 credentials to v2 should be done in the KinesisClients.New, which is called in the refresh operations. This way, you can convert all kinesis to v2 and only do the v1->v2 in the New right?

@acroca I updated in KinesisClients.New. It is working i checked in local. Let me know if i need to revert back to previous version where we were supporting both v1 and v2.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can do it in the same PR as changing to aws-sdk-v2 is related to update the vmware-go-kcl-v2

Copy link
Contributor

Choose a reason for hiding this comment

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

@mikeee I updated the aws-sdk-v2 issue to track it
#3896

Copy link
Contributor Author

@swatimodi-scout swatimodi-scout Nov 13, 2025

Choose a reason for hiding this comment

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

I think you can do it in the same PR as changing to aws-sdk-v2 is related to update the vmware-go-kcl-v2

@javier-aliaga Please review the code.

Signed-off-by: swatimodi-scout <[email protected]>
@swatimodi-scout swatimodi-scout force-pushed the feat/kinesis-binding-vmware-go-kcl-v2-latest branch from 01bf923 to 45d9390 Compare November 13, 2025 13:05
swatimodi-scout and others added 2 commits November 14, 2025 12:28
Signed-off-by: swatimodi-scout <[email protected]>
Signed-off-by: rideshnath-scout <[email protected]>
@rideshnath-scout rideshnath-scout force-pushed the feat/kinesis-binding-vmware-go-kcl-v2-latest branch from 2c85b67 to 9dafc6d Compare November 14, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants