Skip to content

Server rpcv2Cbor implementation can't deserialize operations with no input #1020

@0marperez

Description

@0marperez

The server rpcv2Cbor implementation seems like it can't deserialize operations that don't have any input. I was following this part of the Smithy Java quick-start example, and it works fine for restJson1 but not for rpcv2Cbor. I get the following error message:

software.amazon.smithy.java.core.serde.SerializationException: Can't read FINISHED as a struct
        at software.amazon.smithy.java.cbor.CborDeserializer.badType(CborDeserializer.java:140)
        at software.amazon.smithy.java.cbor.CborDeserializer.readStruct(CborDeserializer.java:290)
        at io.smithy.java.server.example.model.GetHoursInput$Builder.deserialize(GetHoursInput.java:99)
        at io.smithy.java.server.example.model.GetHoursInput$Builder.deserialize(GetHoursInput.java:83)
        at software.amazon.smithy.java.core.serde.Codec.deserializeShape(Codec.java:129)
        at software.amazon.smithy.java.server.protocols.rpcv2.RpcV2CborProtocol.lambda$deserializeInput$0(RpcV2CborProtocol.java:80)
        at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:684)
        at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:662)
        at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168)
        at software.amazon.smithy.java.server.protocols.rpcv2.RpcV2CborProtocol.deserializeInput(RpcV2CborProtocol.java:79)
        at software.amazon.smithy.java.server.core.ProtocolHandler.before(ProtocolHandler.java:14)
        at software.amazon.smithy.java.server.core.SingleThreadOrchestrator$JobWork.run(SingleThreadOrchestrator.java:98)
        at software.amazon.smithy.java.server.core.SingleThreadOrchestrator$ConsumerTask.run(SingleThreadOrchestrator.java:156)
        at java.base/java.lang.Thread.run(Thread.java:833)

I'm not sure if there's something extra that I need to configure, to replicate this behavior:

  1. Complete the Java Quickstart example (including the "Make a change to the service" section).
  2. Replace restJson1 with rpcv2Cbor in the CoffeeShop service model
  3. Replace the restJson server implementation dependency with the rpcv2Cbor one in the server build script
  4. Replace the restJson client implementation dependency with the rpcv2Cbor one in the client build script
  5. Replace the restJson protocol configuration with rpcv2Cbor configuration in the client smithy build file
  6. Run the server, then the client application.

I also tried the same no-input operation with a Smithy Kotlin client instead of a Smithy Java client and the same thing happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions