You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing it to something unknown like "contentType": "application/octet-stream-x" fails, with NotSupportedError: Content type application/octet-stream-x not supported
which is fine.
Changing it to "contentType": "application/opcua+octet-stream" creates a different error.
NotSupportedError: Invalid value according to DataSchema
at InteractionOutput.value (...\opcua-test\node_modules\@node-wot\core\dist\interaction-output.js:129:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async ...\opcua-test\test.js:54:47 {
value: {
Value: { Type: 11, Body: 1500 },
SourceTimestamp: 2025-06-24T15:00:32.167Z
}
}
Maybe it is possible to get the raw data, but I am not sure.
Hence, I wonder whether a simplified fix is also reasonable. What do I mean by that, we remove the contentType for any OPC UA form so that no other ContentSerdes codec can kick in?
Measured on master today, reading a Double over OPC UA:
no contentType: works.
application/octet-stream: fails with dataType.toLowerCase is not a function, wherever type is declared. Core's generic octet-stream codec is decoding OPC UA content.
application/opcua+json: fails in core's schema check, with Invalid value according to DataSchema, or No schema type defined when the TD has no type.
What the PR will do:
The default stays application/json (TD 1.1 §5.3.4.2). OPC 10101 §6.5.3 names the content type to use for the server's own serialization; it does not set a default.
application/octet-stream means the raw bytes of a ByteString (images, files). Any other type is refused with an error naming the form and the actual OPC UA type. OPC UA Binary cannot be decoded without the data type's encoding rules, so it is only offered as application/opcua+octet-stream.
Reads go through the binding's own content negotiation, using the type the server reports.
Activity
danielpeintner commentedon Jun 24, 2025
Changing it to something unknown like
"contentType": "application/octet-stream-x"fails, withNotSupportedError: Content type application/octet-stream-x not supportedwhich is fine.
Changing it to
"contentType": "application/opcua+octet-stream"creates a different error.danielpeintner commentedon Jun 24, 2025
I think the problem is, that the node-opcua library we are using converts the data on the wire directly to a DataValue class by calling
read(...).node-wot/packages/binding-opcua/src/opcua-protocol-client.ts
Lines 305 to 313 in 3325e12
Maybe it is possible to get the raw data, but I am not sure.
Hence, I wonder whether a simplified fix is also reasonable. What do I mean by that, we remove the
contentTypefor any OPC UA form so that no other ContentSerdes codec can kick in?@sebastiankb @egekorkan do you think that is okay?
@erossignon do you have another proposal?
danielpeintner commentedon Jun 25, 2025
In #1402 I show what I intend to do...
egekorkan commentedon Jun 25, 2025
The developer should not need to do that but if node-wot does it internally until a better solution is available, I would be ok with it.
danielpeintner commentedon Jun 25, 2025
I agree. We should keep this issue open in any case until we find a better solution.
danielpeintner commentedon Jun 25, 2025
BTW, the developer doesn't need to do anything. We take care internally...
erossignon commentedon Sep 1, 2025
I'm on it
danielpeintner commentedon Oct 14, 2025
@erossignon any updates you can share with us?
chore(binding-opcua) fix application/octet-stream encoding/decoding e…
erossignon commentedon Oct 15, 2025
@danielpeintner here you go , thank you for your patience.
chore(binding-opcua) fix application/octet-stream encoding/decoding e…
danielpeintner commentedon Sep 14, 2026
@erossignon do you plan to work on the content type issues?
erossignon commentedon Sep 14, 2026
Yes this is the next big item and is almost done on my side...
Actually waiting for the pending PRs to be merged on master , as my work relies on them...
erossignon commentedon Sep 21, 2026
@danielpeintner @sebastiankb @egekorkan @relu91 the proposal for this issue. #1449 is closed; this replaces it.
Measured on master today, reading a Double over OPC UA:
contentType: works.application/octet-stream: fails withdataType.toLowerCase is not a function, wherevertypeis declared. Core's generic octet-stream codec is decoding OPC UA content.application/opcua+json: fails in core's schema check, withInvalid value according to DataSchema, orNo schema type definedwhen the TD has notype.What the PR will do:
application/json(TD 1.1 §5.3.4.2). OPC 10101 §6.5.3 names the content type to use for the server's own serialization; it does not set a default.application/octet-streammeans the raw bytes of a ByteString (images, files). Any other type is refused with an error naming the form and the actual OPC UA type. OPC UA Binary cannot be decoded without the data type's encoding rules, so it is only offered asapplication/opcua+octet-stream.Not in this PR: the
application/opcua+jsonschema-check failures. They belong with #1243 and #1265.@danielpeintner this covers what #1402 was after, while keeping
contentType. OK to close #1402 in favour of it?test(binding-opcua): end-to-end contentType matrix for eclipse-thingw…
test(binding-opcua): end-to-end contentType matrix for eclipse-thingw…
fix(binding-opcua): own the octet-stream codec for opc.tcp forms (#1400…