Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Migration of Http adapters fail if HttpHeaders are present #719

Open
DC2-DanielKrueger opened this issue Dec 20, 2024 · 1 comment

Comments

@DC2-DanielKrueger
Copy link
Contributor

DC2-DanielKrueger commented Dec 20, 2024

Expected behavior

Http Protocol Adapter Configs with HttpHeaders inside them will be migrated automatically

Actual behavior

The start after the migration fails with

java.util.concurrent.CompletionException: com.hivemq.exceptions.HiveMQEdgeStartupException: java.lang.IllegalArgumentException: Cannot deserialize value of type `java.util.ArrayList<com.hivemq.edge.adapters.http.config.HttpSpecificAdapterConfig$HttpHeader>` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.hivemq.edge.adapters.http.tag.HttpTag["definition"]->com.hivemq.edge.adapters.http.tag.HttpTagDefinition["httpHeaders"])
	at java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:412)
	at java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2050)
	at com.hivemq.embedded.internal.EmbeddedHiveMQExtension.afterEach(EmbeddedHiveMQExtension.java:161)
... 
Caused by: com.hivemq.exceptions.HiveMQEdgeStartupException: java.lang.IllegalArgumentException: Cannot deserialize value of type `java.util.ArrayList<com.hivemq.edge.adapters.http.config.HttpSpecificAdapterConfig$HttpHeader>` from Object value (token `JsonToken.START_OBJECT`)

To Reproduce

    <http>
            <destination>someDest</destination>
            <httpRequestBodyContentType>JSON</httpRequestBodyContentType>
            <httpHeaders>
                <httpHeader>
                    <name>Authorization</name>
                    <value>Basic yddaf=</value>
                </httpHeader>
            </httpHeaders>
            <maxPollingErrorsBeforeRemoval>10</maxPollingErrorsBeforeRemoval>
            <httpRequestMethod>GET</httpRequestMethod>
            <url>https://somewhere.com/piwebapi/</url>
            <allowUntrustedCertificates>true</allowUntrustedCertificates>
            <qos>0</qos>
            <httpPublishSuccessStatusCodeOnly>true</httpPublishSuccessStatusCodeOnly>
            <pollingIntervalMillis>60000</pollingIntervalMillis>
            <httpConnectTimeout>60</httpConnectTimeout>
            <id>PiWebApi_Sample</id>
            <assertResponseIsJson>true</assertResponseIsJson>
        </http>

Details

  • Affected HiveMQ Edge version(s):
  • Used JVM version:
@DC2-DanielKrueger
Copy link
Contributor Author

DC2-DanielKrueger commented Dec 20, 2024

This can be fixed by hand. The problem is that the single http header is not encasulated in a tag:

<httpHeaders>
     <name>Authorization</name>
    <value>Basic BLUB</value>
</httpHeaders>

needs to be

<httpHeaders>
    <httpHeader>
         <name>Authorization</name>
        <value>Basic BLUB</value>
    </httpHeader>
</httpHeaders>

this has to be fixed in the config.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant