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

Node-opcua inherits variables from objectType with same name as variable browseName. #1326

Closed
tetanw opened this issue Dec 8, 2023 · 4 comments
Labels
bug Fixed: requesting verification The bug has been resolved and is expecting extra validation by the community t

Comments

@tetanw
Copy link
Contributor

tetanw commented Dec 8, 2023

Current behavior / Describe the bug

When a variable's BrowseName on one objectType matches the name of another objectType that inherits from BaseObjectType then it will take over the reference from that objectType when instantiating.

See the configuration in the Siemens modelling editor:
image
image

See how the instantiated node looks like:
image

Step by step instruction to reproduce

Steps to reproduce the behavior:

  1. Copy files from gist into a folder
  2. Copy the standard nodeset Opc.Ua.NodeSet2.xml into the folder as well
  3. npm install
  4. node server.js
  5. Open any OpcUa browser and see the issue

Expected behavior

In the example scenario in the image I would expect only the Name variable to be there.

Gist

gist: https://gist.github.com/tetanw/248223774efafe9a5593dbd55f063145

Context

  • ( ) my request is related to node-opcua acting as an OPCUA CLIENT

  • (x) my request is related to node-opcua acting as an OPCUA SERVER

  • ( ) I have installed node-opcua from source ( using git clone)

  • (x) I have installed node-opcua as a package ( using npm install )

  • ( ) I am using an application that uses node-opcua

    • ( ) node-red
    • ( ) other : please specify
  • Device: Lenovo Thinkstation P700

  • OS version:

    • (x) Windows : version : Windows 10 Enterprise, 21H2
    • ( ) Linux : version : ______
    • ( ) MacOs : version : ______
    • ( ) Raspbian: version : ______
    • ( ) Other : specify : ______
  • Description of the other OPCUA system I am trying to connect to: NA

  • node-opcua version: 2.118.0

  • Node: v18.16.0

@tetanw
Copy link
Contributor Author

tetanw commented Dec 8, 2023

Might actually be related to #1320.

@tetanw
Copy link
Contributor Author

tetanw commented Dec 8, 2023

Just to clarify this only goes wrong when doing dynamic object instantiation, i.e. objectType.instantiate(...). When I add a xml file with the objectType already instantiated by the Siemens OPCUA modelling editor, this just works correctly.

@tetanw
Copy link
Contributor Author

tetanw commented Dec 11, 2023

Problem is probably caused by this line of code:

const typeDefinitionChild = typeDefinitionNode.getChildByName(node.browseName);

The while loop keeps iterating until it reaches BaseObjectType where it finds a child with the name Other even though Other is just a subType of BaseObjectType. I think this line needs to be changed into just searching among the nodes with a Aggregates relation instead of a Child relation.

tetanw pushed a commit to tetanw/node-opcua that referenced this issue Dec 11, 2023
…ed object type to a node with the same browseName.
tetanw pushed a commit to tetanw/node-opcua that referenced this issue Dec 11, 2023
…ed object type to a node with the same browseName.
tetanw added a commit to tetanw/node-opcua that referenced this issue Dec 11, 2023
…ed object type to a node with the same browseName.
erossignon pushed a commit that referenced this issue Feb 20, 2024
@erossignon
Copy link
Member

fixed in node-opcua@2.121.0

@erossignon erossignon added bug Fixed: requesting verification The bug has been resolved and is expecting extra validation by the community t labels Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixed: requesting verification The bug has been resolved and is expecting extra validation by the community t
Projects
None yet
Development

No branches or pull requests

2 participants