Giter Site home page Giter Site logo

Comments (8)

ridomin avatar ridomin commented on August 16, 2024

Hi @rysotope, unfortunately I'm having issues with my AWS account and I cannot run the AWS Shadow Client anymore.

Last time I tried the ShadowBinders :
Sample:
https://github.com/iotmodels/MQTTnet.Extensions.MultiCloud/blob/master/samples/aws-sample/Device.cs

Tests:
https://github.com/iotmodels/MQTTnet.Extensions.MultiCloud/blob/master/tests/MQTTnet.Extensions.MultiCloud.IntegrationTests/AwsClientFixture.cs#L22

Did any of these work for you?

from mqttnet.extensions.multicloud.

rysotope avatar rysotope commented on August 16, 2024

Hi @ridomin

I tried the unit test as you suggested, and was able to recreate the issue.

image

GetShadowAsync() returned:
{"state":{"desired":{"welcome":"aws-iot"},"reported":{"welcome":"aws-iot"}},"metadata":{"desired":{"welcome":{"timestamp":1675697222}},"reported":{"welcome":{"timestamp":1675697222}}},"version":1,"timestamp":1675697681}

Here's the stack trace:
System.InvalidOperationException
HResult=0x80131509
Message=Nullable object must have a value.
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_NoValue()
at System.Nullable1.get_Value() at MQTTnet.Extensions.MultiCloud.AwsIoTClient.ShadowSerializer.ToBytes[T](T payload, String name, Nullable1 version) in C:\Source\GitHub\MQTTnet.Extensions.MultiCloud\src\MQTTnet.Extensions.MultiCloud.AwsIoTClient\ShadowSerializer.cs:line 33
at MQTTnet.Extensions.MultiCloud.AwsIoTClient.ShadowRequestResponseBinder.d__11.MoveNext() in C:\Source\GitHub\MQTTnet.Extensions.MultiCloud\src\MQTTnet.Extensions.MultiCloud.AwsIoTClient\ShadowRequestResponseBinder.cs:line 109
at MQTTnet.Extensions.MultiCloud.IntegrationTests.AwsClientFixture.d__1.MoveNext() in C:\Source\GitHub\MQTTnet.Extensions.MultiCloud\tests\MQTTnet.Extensions.MultiCloud.IntegrationTests\AwsClientFixture.cs:line 27

This exception was originally thrown at this call stack:
[External Code]
MQTTnet.Extensions.MultiCloud.AwsIoTClient.ShadowSerializer.ToBytes(T, string, int?) in ShadowSerializer.cs
MQTTnet.Extensions.MultiCloud.AwsIoTClient.ShadowRequestResponseBinder.UpdateShadowAsync(object, System.Threading.CancellationToken) in ShadowRequestResponseBinder.cs
MQTTnet.Extensions.MultiCloud.IntegrationTests.AwsClientFixture.GetUpdateShadow() in AwsClientFixture.cs

from mqttnet.extensions.multicloud.

ridomin avatar ridomin commented on August 16, 2024

I'm sorry but I'm not able to access my AWS resources for testing anymore :(

I tried to fix this issue here 7e0e1ae, let me know if it works for you before merging into dev

from mqttnet.extensions.multicloud.

rysotope avatar rysotope commented on August 16, 2024

Your changes worked :) Thank you!

Returned state after the test:
{"state":{"desired":{"welcome":"aws-iot"},"reported":{"welcome":"aws-iot","name":"rido3"}},"metadata":{"desired":{"welcome":{"timestamp":1675697222}},"reported":{"welcome":{"timestamp":1675697222},"name":{"timestamp":1675707985}}},"version":2,"timestamp":1675708098}

from mqttnet.extensions.multicloud.

ridomin avatar ridomin commented on August 16, 2024

thanks for checking, I'm merging into dev and it will be fixed by the next release.

I'd love to learn more about your use case. Are you planning to take a dependency on this project packages to interact with AWS shadows? or just borrow the code?

I'm asking because I was thinking to remove AWS support in future versions.

from mqttnet.extensions.multicloud.

rysotope avatar rysotope commented on August 16, 2024

I've been working on a PoC for my company involving your libraries.
Originally we had thought to leverage something in-house like Mosquitto but pivoted to AWS.
To be honest, I'm not sure we have a use case for shadows, I would probably leverage some other mechanism for retained/desired settings vs the AWS implementation.

from mqttnet.extensions.multicloud.

ridomin avatar ridomin commented on August 16, 2024

The Broker client implements reported/desired using retained messages, that might be helpful.

https://github.com/iotmodels/MQTTnet.Extensions.MultiCloud/blob/master/src/MQTTnet.Extensions.MultiCloud.BrokerIoTClient/WritableProperty.cs

Beyond that, is there anything else you need? if not, can you close this issue?

from mqttnet.extensions.multicloud.

rysotope avatar rysotope commented on August 16, 2024

Thank you for your support!

from mqttnet.extensions.multicloud.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.