Skip to content

fix(common.opcua): Support byte arrays in decoding#18825

Open
wucm667 wants to merge 1 commit intoinfluxdata:masterfrom
wucm667:fix/opcua-bytearray-decode
Open

fix(common.opcua): Support byte arrays in decoding#18825
wucm667 wants to merge 1 commit intoinfluxdata:masterfrom
wucm667:fix/opcua-bytearray-decode

Conversation

@wucm667
Copy link
Copy Markdown

@wucm667 wucm667 commented Apr 30, 2026

Summary

When decoding OPC UA variant arrays, the plugin crashes when encountering ua.ByteArray values because the decoder does not handle this specific type. This fix adds proper handling for ua.ByteArray in the variant array decoding logic, preventing the crash.

Checklist

Related issues

resolves #18824

The type switch in the OPC UA input plugin was missing a case for
ua.ByteArray, which is a named type (type ByteArray []byte) in the
gopcua library. Go's type switch does not match named types against
their underlying types, causing ByteArray values to fall through to
the default error case.

Add a case for ua.ByteArray that converts to []byte for proper
unpacking.

Fixes influxdata#18824
@telegraf-tiger
Copy link
Copy Markdown
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger Bot added the fix pr to fix corresponding bug label Apr 30, 2026
@telegraf-tiger
Copy link
Copy Markdown
Contributor

@wucm667
Copy link
Copy Markdown
Author

wucm667 commented Apr 30, 2026

!signed-cla

@srebhan
Copy link
Copy Markdown
Member

srebhan commented Apr 30, 2026

@wucm667 please restore the PR description template, especially the AI section! Otherwise we cannot review your contribution...

@srebhan srebhan self-assigned this Apr 30, 2026
@wucm667
Copy link
Copy Markdown
Author

wucm667 commented Apr 30, 2026

Done, restored the template and filled in the checklist. Thanks for the reminder!

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @wucm667!

@srebhan srebhan changed the title fix(opcua): handle ua.ByteArray in variant array decoding fix(opcua): Support byte arrays in decoding May 4, 2026
@srebhan srebhan changed the title fix(opcua): Support byte arrays in decoding fix(common.opcua): Support byte arrays in decoding May 4, 2026
@srebhan srebhan added plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels May 4, 2026
@srebhan srebhan assigned skartikey and unassigned srebhan May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/opcua fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

inputs.opcua: cannot decode VariantType=Byte arrays (ua.ByteArray)

3 participants