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:
- Complete the Java Quickstart example (including the "Make a change to the service" section).
- Replace
restJson1 with rpcv2Cbor in the CoffeeShop service model
- Replace the
restJson server implementation dependency with the rpcv2Cbor one in the server build script
- Replace the
restJson client implementation dependency with the rpcv2Cbor one in the client build script
- Replace the
restJson protocol configuration with rpcv2Cbor configuration in the client smithy build file
- 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.
The server
rpcv2Cborimplementation 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 forrestJson1but not forrpcv2Cbor. I get the following error message:I'm not sure if there's something extra that I need to configure, to replicate this behavior:
restJson1withrpcv2Cborin theCoffeeShopservice modelrestJsonserver implementation dependency with therpcv2Cborone in the server build scriptrestJsonclient implementation dependency with therpcv2Cborone in the client build scriptrestJsonprotocol configuration withrpcv2Cborconfiguration in the client smithy build fileI also tried the same no-input operation with a Smithy Kotlin client instead of a Smithy Java client and the same thing happens.