node-red-contrib-opcua-server-refresh 0.2.5
Fork of the original 'node-red-contrib-opcua-server' package that is no longer maintained. This has been refactored to support the latest version of node-opcua and fixes incomplete/non-working features.
node-red-contrib-opcua-server-refresh
A modern, secure, and TypeScript-powered OPC UA server for Node-RED based on the latest node-opcua library.
๐ Major Release Updates
This release represents a complete modernization of the OPC UA server with significant improvements in security, reliability, and developer experience.
๐ What's New
- ๐ง Complete TypeScript Migration: Full type safety and enhanced developer experience
- ๐ Critical Security Fixes: Eliminated vulnerabilities with secure direct execution
- โก Stable node-opcua Support: Updated to stable version 2.154.0 with full compatibility
- โ Comprehensive Testing: 61 tests with 100% pass rate ensuring reliability
- ๐๏ธ Modern Architecture: Modular design with enhanced error handling
๐ About
NOTE: This is a fork and modernization of the original node-red-contrib-opcua-server
by Klaus Landsdorf, which has not been maintained for over 2 years. This updated version was created by Richard Meyer to work with the latest versions of node-opcua and its dependencies, while fixing broken/incomplete features from the original project.
Key Improvements Over Original
- โ Loading of nodeset XML files from inside the node configuration
- โ Full OPC UA security policy support with modern implementations
- โ TypeScript support for better development experience
- โ Comprehensive test suite ensuring reliability
- โ Latest dependencies with active maintenance
๐ Security Enhancements
Critical Vulnerability Fixes
This version eliminates critical security vulnerabilities present in the original package:
- CVE-2023-29017 & CVE-2023-30547: Replaced vulnerable vm2 library with secure direct execution
- Enhanced Security: Prototype pollution protection and input validation
- Secure Script Execution: Timeout limits and enhanced error handling
- Modern Security Practices: Following Node.js security best practices
๐๏ธ Core Technology
- Direct Execution: Secure script execution replacing vulnerable vm2
- node-opcua 2.154.0: Stable generation OPC UA library from Etienne Rossignon
- TypeScript: Full type safety and enhanced development experience
- Comprehensive Testing: 61 tests covering all functionality
๐ฆ Installation
Run the following command in your Node-RED user directory - typically ~/.node-red
:
npm install node-red-contrib-opcua-server-refresh
Build from Source (if needed)
If you encounter installation issues, try these options:
npm install node-red-contrib-opcua-server-refresh --unsafe-perm --build-from-source
๐ Quick Getting Started
Basic Setup
- Add the OPC UA Server node to your Node-RED flow
- Configure the endpoint: Set the endpoint URL (default:
opc.tcp://localhost:54840
) - Deploy your flow: The server will start automatically
Default Configuration
A detailed example server is included with pre-populated address space nodes deployed in various formats. If you use the default port 54840
, simply define the endpoint URL in the format:
opc.tcp://<node-red-ip>:54840
Testing Your Server
We recommend Prosys OPC UA Browser for testing:
- Install an OPC UA client (Prosys is free with email registration)
- Connect to your endpoint using the URL above
- Set security to "None" for initial testing (anonymous login)
- Browse the Objects folder to see your data
๐ง Advanced Configuration
Loading Nodeset XML Files
Navigate to the Users & Sets tab and enter the absolute path to your nodeset XML file.
Pre-included Nodesets:
This package includes nodesets in src/public/nodesets/
. Example path:
/root/.node-red/node_modules/node-red-contrib-opcua-server-refresh/src/public/nodesets/Opc.Ua.AutoID.NodeSet2.xml
Validation: Successfully loaded nodesets appear in Types โ DataTypes โ XML Schema in your OPC UA client.
TypeScript Development
For developers working with TypeScript:
# Development build with source maps
npm run build:dev
# Watch mode for development
npm run watch
# Production build
npm run build:ts
Security Configuration
- Anonymous Access: Enabled by default for easy setup
- User Authentication: Configure in the Users & Sets tab
- Certificate Security: Specify certificate paths for secure connections
- Security Policies: Support for modern OPC UA security standards
๐ Detailed Guides
For comprehensive setup guides, see our detailed tutorials:
- Part 1: Deploy a Basic OPC-UA Server in Node-Red
- Part 2: Build a Secure OPC-UA Server with PLC Data
- Part 3: Build an OPC-UA Client Dashboard
๐ Examples
Example projects are provided in the examples
folder:
- example-server.json: Basic server configuration
- example-with-context.json: Dynamic data from flow context
Simply copy the JSON and import into your Node-RED flows.
๐ Debug & Troubleshooting
Verbose Logging
Enable debug logging for detailed information:
DEBUG=opcuaCompact* node-red -v 1>Node-RED-OPC-UA-Server.log 2>&1
Common Issues
- "Cannot read properties of null": Check nodeset file path is correct
- Connection refused: Verify endpoint URL and port availability
- Security errors: Ensure security settings match between client and server
๐งช Testing
This package includes comprehensive testing:
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Clear test cache
npm run test:clearCache
Test Coverage: 61 tests covering all functionality with 100% pass rate.
๐ ๏ธ Development
Prerequisites
- Node.js 20+
- TypeScript 4.7+
- npm or yarn
Development Workflow
# Install dependencies
npm install
# TypeScript development build
npm run build:dev
# Watch mode for development
npm run watch
# Run tests
npm test
# Format code
npm run clean:formatter
Code Style
This project uses Prettier for code formatting. All TypeScript files are automatically formatted on build.
๐ License
MIT License - Based on the original work by Bianco Royal Software Innovationsยฎ
Copyright (c) 2019 Bianco Royal Software Innovationsยฎ
Forked and modernized by Richard Meyer 2025
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
๐ Support
- Issues: GitHub Issues
- Node-RED Catalog: flows.nodered.org
- Documentation: This README and inline code documentation