Azure / Azure/azure-iot-explorer

[BUG] "utf-8" received in header : absolute-expiry-time

Open
#563 0 comments 0 reactions 0 assignees View on GitHub
bug needs review
Dominant language
TypeScript
Stars
252
Forks
85
Avg merge
3h 32m
Merged PRs (30d)
2

Description

I'm using Azure IOT explorer
image

here my I did :

I created a device and I changed a desired property value and click SAVE. The value was [newtest2345] and changed to [newtest23456]
in the tab Network (developer tools) I have this (I replaced some text with )

the request DataPlane:
````
{"apiVersion":"2020-06-30-preview","body":"{\"deviceId\":\"derniertest\",\"etag\":\"AAAAAAAAABo=\",\"deviceEtag\":\"ODQ4NDk5Mzk=\",\"status\":\"enabled\",\"statusUpdateTime\":\"2022-10-11T12:33:31.5369789Z\",\"connectionState\":\"Disconnected\",\"lastActivityTime\":\"2022-10-18T19:49:51.1552214Z\",\"cloudToDeviceMessageCount\":0,\"authenticationType\":\"sas\",\"x509Thumbprint\":{\"primaryThumbprint\":null,\"secondaryThumbprint\":null},\"modelId\":\"\",\"version\":27,\"properties\":{\"desired\":{\"test\":\"newtest23456\",\"$metadata\":{\"$lastUpdated\":\"2022-10-19T12:10:35.7728649Z\",\"$lastUpdatedVersion\":26,\"test\":{\"$lastUpdated\":\"2022-10-19T12:10:35.7728649Z\",\"$lastUpdatedVersion\":26}},\"$version\":26},\"reported\":{\"$metadata\":{\"$lastUpdated\":\"2022-09-30T19:29:03.6006968Z\"},\"$version\":1}},\"capabilities\":{\"iotEdge\":false}}","hostName":".azure-devices.net","httpMethod":"PATCH","path":"twins/derniertest","sharedAccessSignature":"SharedAccessSignature sr=.azure-devices.net&sig=ZjONPDFufMG1%3D&se=1666182004&skn=iothubowner"}
````

the response
````
{"body":{"deviceId":"derniertest","etag":"AAAAAAAAABs=","deviceEtag":"ODQ4NDk5Mzk=","status":"enabled","statusUpdateTime":"2022-10-11T12:33:31.5369789Z","connectionState":"Disconnected","lastActivityTime":"2022-10-18T19:49:51.1552214Z","cloudToDeviceMessageCount":0,"authenticationType":"sas","x509Thumbprint":{"primaryThumbprint":null,"secondaryThumbprint":null},"modelId":"","version":28,"properties":{"desired":{"test":"newtest23456","$metadata":{"$lastUpdated":"2022-10-19T12:15:03.7924736Z","$lastUpdatedVersion":27,"test":{"$lastUpdated":"2022-10-19T12:15:03.7924736Z","$lastUpdatedVersion":27}},"$version":27},"reported":{"$metadata":{"$lastUpdated":"2022-09-30T19:29:03.6006968Z"},"$version":1}},"capabilities":{"iotEdge":false}},"headers":{"content-length":"729","content-type":"application/json; charset=utf-8","vary":"Origin","server":"Microsoft-HTTPAPI/2.0","x-ms-request-id":"85863b67-69af-4742-94a7-01cb3e2b7eb5","date":"Wed, 19 Oct 2022 12:15:05 GMT","connection":"close"}}
````

The workflow is :

IOT Explorer -> IotHub -> routing to Eventhub endpoint -> application using Azure Java SDK.

in my listener in Java, I received these headers
````
{"azure_eventhubs_sequence_number":25,"operationTimestamp":"2022-10-19T12:15:03.7924736Z","content-encoding":"utf-8","correlation-id":"362f012e4089","user-id":"aW90aHViLXBvYy1zZGlvbm5l","opType":"updateTwin","azure_raw_partition_id":"2","iothub-enqueuedtime":"2022-10-19T12:15:03.802+00:00","absolute-expiry-time":"utf-8","deviceId":"derniertest","x-opt-enqueued-time":"2022-10-19T12:15:03.957Z","iothub-message-schema":"twinChangeNotification","x-opt-sequence-number":25,"iothub-connection-device-id":"derniertest","iothub-message-source":"twinChangeEvents","azure_eventhubs_enqueued_time":"2022-10-19T12:15:03.957Z","hubName":"iothub-poc-sdionne","content-type":"application/json","x-opt-offset":8589937216,"id":"ac7b5f6c-65b0-3680-1829-909206e28eec","contentType":{"type":"application","subtype":"json","parameters":{},"charset":null,"concrete":true,"wildcardType":false,"wildcardSubtype":false,"subtypeSuffix":null},"azure_eventhubs_offset":8589937216,"timestamp":1666182096792}
````

I don't know what should be the value, but utf-8 is certainly wrong
absolute-expiry-time":**"utf-8"**

here a screenshot of the data received

image

here my pom.xml

````

4.0.0

org.springframework.boot
spring-boot-starter-parent
2.7.3


com.comact
poc-iothub-to-dax
0.0.1-SNAPSHOT
poc-iothub
Demo project for Spring Boot

11
4.4.0
1.6.11




com.microsoft.azure.sdk.iot
iot-device-client
2.1.2


com.microsoft.azure.iothub-java-client
iothub-java-service-client
1.0.11


org.springframework.boot
spring-boot-starter-actuator


org.springframework.boot
spring-boot-starter-webflux


com.azure.spring
spring-cloud-azure-starter


com.azure.spring
spring-cloud-azure-starter-actuator


com.azure.spring
spring-cloud-azure-stream-binder-eventhubs
4.4.0


org.projectlombok
lombok
true


org.springdoc
springdoc-openapi-webflux-ui
${springdoc.version}


org.springframework.boot
spring-boot-starter-test
test


io.projectreactor
reactor-test
test





com.azure.spring
spring-cloud-azure-dependencies
${spring-cloud-azure.version}
pom
import



poc-iothub-to-dax


org.apache.maven.plugins
maven-compiler-plugin
3.3

${java.version}
${java.version}



org.springframework.boot
spring-boot-maven-plugin


org.springdoc
springdoc-openapi-maven-plugin
1.4


````

here the java class
````java
package com.example.demo.consumer;

import com.example.demo.model.TestModel;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.Message;

import java.util.function.Consumer;

@Configuration
public class TwinChangeEventsConsumer {
private static final Logger LOGGER = LoggerFactory.getLogger(TwinChangeEventsConsumer.class);

@Autowired
ObjectMapper objectMapper;

@Bean
Consumer> twinchangeevents() {
return message -> {
LOGGER.info("Consumed a twinchangeevents [{}] headers [{}]", message.getPayload(), message.getHeaders());

try {
String headers = objectMapper.writeValueAsString(message.getHeaders());

TestModel model = objectMapper.readValue(headers, TestModel.class);
model.setRaw(message.getPayload());

} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}

};
}

}
````

Contributor guide

Open the contributing guide

Research direction

Reproduce the Azure IoT Explorer → IoT Hub → Event Hub workflow described in the issue, then inspect pom.xml and the reported TwinChangeEventsConsumer entry point, especially how message headers are logged and mapped. Confirm whether absolute-expiry-time is malformed at the Azure boundary or during Java/Spring message handling; done means identifying the responsible component and documenting or testing the corrected header value.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java, spring-boot
Domain
backend, cloud, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.