Skip to content

bindings/redis: use errors.Is(redis.Nil) instead of hardcoded "redis: nil" string match #4424

Description

@AdilRMallick

Expected Behavior

When a GET operation in the Redis output binding finds no value for a key, the binding should return an empty InvokeResponse (treating it as a miss), regardless of whether the underlying go-redis nil error has been wrapped. This is consistent with how the rest of the Redis component detects nil values via the sentinel error.

Actual Behavior

bindings/redis detects a key-miss by string-matching the error text:
go// bindings/redis/redis.go, line ~109
if err.Error() == "redis: nil" {
return &bindings.InvokeResponse{}, nil
}

If the error is wrapped like it is commonly found in GO practice the miss will go in undetected. A hard error will be returned. This is also inconsistent with the rest of the code:
common/component/redis/v8client.go#L111 → errors.Is(err, v8.Nil)
common/component/redis/v9client.go#L111 → errors.Is(err, v9.Nil)
configuration/redis/redis.go#L137 → compares against redis.Nil.Error()

Steps to Reproduce the Problem

Consistency defect not a UI or runtime error.

  1. In bindings/redis/redis.go, the GetOperation calls r.client.Get(ctx, key) (or GetDel).
  2. On a missing key, go-redis returns its Nil sentinel error.
  3. The handler compares err.Error() == "redis: nil" to decide it's a miss.
  4. The miss is only detected when the error string is exactly "redis: nil". Any wrapping of the error (e.g. fmt.Errorf("...: %w", err)) breaks the match, and the binding surfaces an error instead of an empty response.

Release Note

RELEASE NOTE: FIX Redis output binding handles wrapped nil errors on key misses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions