-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Background
To maintain optimal performance and security:
OpenSearch Dashboards is upgrading from Node.js v18 to v20
With plans to deprecate explicit support for older versions of Node.js. The current version OpenSearch Dashboards will soon EOL so therefore we must upgrade.
Node.js Version End-of-Life Dates
- Node.js 14 (LTS): Security support ended on April 30, 2023.
- Node.js 16 (LTS): Security support ended on September 11, 2023.
- Node.js 18 (LTS): Security support ends on April 30, 2025.
- Node.js 20 (LTS): Security support ends on April 30, 2026.
- Node.js 22 (LTS): Security support ends on April 30, 2027.
Recent plugin build and installation tests on the feature/node-2x branch have ✅PASSED✅.
OpenSearch Dashboards starts without issue under Node.js v20. However, plugin owners should verify their own plugins to ensure compatibility as soon as possible.
Timeline
We plan to merge this upgrade by the first week of March 2025. If no critical issues are reported by then, we will proceed with the upgrade. Please test and report any issues before this deadline.
Action Items
Recommended steps for plugin testing:
- Checkout the feature branch with OpenSearch Dashboards root directory
git checkout feature/node-2x
# Install Node v20 (ensure you have NVM installed)
nvm install
# Install yarn
curl -o- -L https://yarnpkg.com/install.sh | bash
# Bootstrap OpenSearch Dashboards
yarn osd bootstrap --single-version=loose
# Start OpenSearch Dashboards
yarn start- Run automated tests within your plugin.
- Perform manual functional testing to confirm everything works as expected.
Potential Issues
Node.js 20 Upgrade Issues and Solutions
| Issue | Description | Solution |
|---|---|---|
| Deprecation Warnings | Node.js v20 has stricter URL parsing rules, causing warnings for invalid URL formats in package.json dependencies | Update URL format in package.json files (e.g., browserify-rsa#20) |
| Encoding Format | Node.js v20.5.0+ no longer accepts 'utf-8' (with hyphen) for encoding | Use 'utf8' (without hyphen) in all fs.readFileSync calls and similar functions |
| Stricter Type Checking | Node.js 20 enforces stricter type comparisons | Explicitly convert between types when making comparisons, especially in tests |
| Polyfill Conflicts | resize-observer-polyfill 1.5.1 conflicts with TypeScript 4.6+ built-in types | Use TypeScript 4.5.5 or update polyfill package |
| Type Definition Issues | @types/lodash v4.17.16+ syntax causes errors | Pin @types/lodash to version 4.14.165 |
| Hapi Upgrade Challenges | Upgrading Hapi framework will be difficult | Consider removing Hapi dependency |
| Error Code Format Changes | Error codes now include UV prefix (UV_EACCES vs EACCES) | Update test expectations to handle new error formats |
| Future Upgrade Complexity | More significant challenges expected with Node.js 22 upgrade | Initial TypeScript upgrade efforts to 4.6+ had to be rolled back to 4.5.5; expect similar compatibility challenges with Node.js 22 |
Action Items
- Update Tests: Modify test expectations to handle new error message formats
- Verify Compression: Ensure brotli and gzip variants match raw data when testing file compression
- Update Encoding References: Use 'utf8' instead of 'utf-8' in:
- HTML Meta Charset tags
- MIME Types in Blob objects
- Node.js Buffer encoding specifications
- Plan Incrementally: Recognize that Node.js 20 is just the first step, with Node.js 22 likely requiring more extensive refactoring
- Node 20 promise handling that Node 18 was quietly tolerating. Example:
dataSources.map((ds) => getDirectQueryConnections(ds.id, http!).catch(() => []))- 5.1. problems:
- Silently swallowing errors with empty catch blocks
- No timeout handling for network requests
- Unbounded Promise.all operations assuming all promises resolve
- Potential memory leaks from unmanaged promises
- 5.2. temp solution:
- I implemented this temporary fix to unblock CI:
Promise.race([ getDirectQueryConnections(ds.id, http!), new Promise((_, reject) => setTimeout(() => reject('timeout'), 5000)) ])
- I implemented this temporary fix to unblock CI:
- 5.3: HOWEVER
- this could be first of many similar issues.when Node 22 arrives, these patterns will become even more problematic
we can continue adding temporary solutions, but we might want to discuss a more sustainable approach before our technical debt becomes unmanageable.
Verification Checklist
Following the manifest order:
- Node.js v20 Upgrade Verification dashboards-reporting#540
- Node.js v20 Upgrade Verification opensearch-dashboards-functional-test#1749
- Node.js v20 Upgrade Verification security-dashboards-plugin#2193
- Node.js v20 Upgrade Verification dashboards-query-workbench#456
- Node.js v20 Upgrade Verification dashboards-search-relevance#496
- Node.js v20 Upgrade Verification dashboards-observability#2366
- Node.js v20 Upgrade Verification dashboards-visualizations#445
- Node.js v20 Upgrade Verification dashboards-assistant#480
- Node.js v20 Upgrade Verification dashboards-flow-framework#652
- Node.js v20 Upgrade Verification dashboards-notifications#332
- Node.js v20 Upgrade Verification dashboards-maps#710
- Node.js v20 Upgrade Verification anomaly-detection-dashboards-plugin#989
- Node.js v20 Upgrade Verification ml-commons-dashboards#406
- Node.js v20 Upgrade Verification index-management-dashboards-plugin#1285
- Node.js v20 Upgrade Verification alerting-dashboards-plugin#1217
- Node.js v20 Upgrade Verification query-insights-dashboards#128
Thank you for your support and collaboration!
Metadata
Metadata
Assignees
Labels
Type
Projects
Status