Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Bridge failing due to "Byte array for GUID must be exactly 16 bytes long" error. #44

Description

@jpengland

I have successfully deployed the IoT Central Bidirectional Bridge to collect data from LoRaWAN sensors. Unfortunately, when the LoRaWAN LNS sends data to the bridge it fails with the following error.

�[41m�[30mfail�[39m�[22m�[49m: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HNKRQUV6SVFK", Request id "0HNKRQUV6SVFK:00000002": An unhandled exception was thrown by the application.
System.ArgumentException: Byte array for GUID must be exactly 16 bytes long. (Parameter 'b')
at System.Guid..ctor(ReadOnlySpan1 b) at DeviceBridge.Common.Utils.GuidFromString(String input) in /app/Common/Utils.cs:line 22 at DeviceBridge.Common.RequestLoggingMiddleware.Invoke(HttpContext context) in /app/Common/RequestLoggingMiddleware.cs:line 58 at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)

When I ran this error through an AI for analysis it identified that SHA256 output is always 32 bytes and that the Guid(byte[]) constructor requires exactly 16 and so it fails. The recommendation was to use MD5 which produces a 16 byte output. However, I see there was a change in the code to move from MD5 to SHA256, presumably for security reasons.

Please can you review and confirm if this is the issue and if it can be fixed, or advise if this is something else that is within my control to change that is causing this error?

Thanks

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