Skip to content

States without etag is handled differently in gRPC and HTTP APIs #405

Description

@artursouza

Expected Behavior

Get a state without eTag in gRPC and HTTP, eTag attribute should be null.

Actual Behavior

eTag is null in HTTP and empty string in gRPC.

Steps to Reproduce the Problem

Get state that does not have eTag.
Try the same in getBulkState too.

Release Note

RELEASE NOTE: FIX missing eTag response for state APIs.

Activity

  1. arghya88 commented on Dec 11, 2020

    @arghya88
    Contributor

    I was looking at this and it seems it's happening because DaprProtos.GetStateResponse has etag_ = "";

    public static final class GetStateResponse extends
          com.google.protobuf.GeneratedMessageV3 implements
          // @@protoc_insertion_point(message_implements:dapr.proto.runtime.v1.GetStateResponse)
          GetStateResponseOrBuilder {
      private static final long serialVersionUID = 0L;
        // Use GetStateResponse.newBuilder() to construct.
        private GetStateResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
          super(builder);
        }
        private GetStateResponse() {
          data_ = com.google.protobuf.ByteString.EMPTY;
          etag_ = "";
        }
    

    This is being picked up here https://github.com/dapr/java-sdk/blob/master/sdk/src/main/java/io/dapr/client/DaprClientGrpc.java#L334
    @artursouza what would be the way to fix this?

  2. artursouza commented on Dec 14, 2020

    @artursouza
    ContributorAuthor

    This should be fixed in the runtime ideally. In my opinion, the fallback is for the SDK to convert empty string to null for GRPC and HTTP implementation to keep them consistent.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions