Weekly GitHub Report for Node - 2024-12-23 12:00:11
Weekly GitHub Report for Node
Thank you for subscribing to our weekly newsletter! Each week, we deliver a comprehensive summary of your GitHub project's latest activity right to your inbox, including an overview of your project's issues, pull requests, contributors, and commit activity.
Table of Contents
I. News
1.1 Recent Version Releases:
The current version of this repository is v23.5.0
1.2 Other Noteworthy Updates:
II. Issues
2.1 Top 5 Active Issues:
We consider active issues to be issues that that have been commented on most frequently within the last week.
-
The function exported using Object.defineProperty in node_modules cannot be found.: This issue involves a problem where a function exported using
Object.defineProperty
in a Node.js module cannot be found when converting from CommonJS (CJS) to ECMAScript Module (ESM) format. The user reports that the functionshouldImport
is not accessible at the top level of the module object as expected, and instead, it is only available within an internal default object, which is not the desired behavior.- The comments discuss various aspects of the issue, including requests for a reproduction that doesn't involve downloading code, and suggestions for modifying the code to avoid using the
__importDefault
function in the getter. There is a suspicion that the issue might be related to a known limitation in thenodejs/cjs-module-lexer
, and it is suggested that a similar issue might exist in the TypeScript repository. The discussion also touches on the potential side effects of accessing named exports and how different tools like Bun handle this situation. - Number of comments this week: None
- The comments discuss various aspects of the issue, including requests for a reproduction that doesn't involve downloading code, and suggestions for modifying the code to avoid using the
-
Environment variable and CLI argument handling in user-land startup snapshots: This issue addresses the handling of environment variables and command-line arguments during the creation and deserialization of user-land startup snapshots in Node.js. It suggests improvements to the current workaround by proposing new APIs and CLI flags to better manage and trace environment variable access, ensuring that the deserialized application reflects the correct runtime environment.
- The comments discuss the implementation of a utility to track accessed environment variables, with suggestions for both global and local recording mechanisms. There is a consensus on the usefulness of such a utility beyond snapshots, with potential applications in testing and ensuring consistency in environment variable access. The conversation also touches on the need for configuration options to facilitate this tracking, both through command-line flags and snapshot configuration files.
- Number of comments this week: None
-
HTTP/1.0 responses missing Content-Length: This issue is about the absence of a
Content-Length
header in HTTP/1.0 responses from a Node.js server, which is consistently reproducible when using cURL to send HTTP/1.0 requests. The expected behavior is that the response should include aContent-Length
header, similar to HTTP/1.1 requests, but it currently does not, leading to potential issues with proxies like Nginx that default to HTTP/1.0.- The comments discuss the implications of the missing
Content-Length
header, particularly when using Nginx as a reverse proxy, which defaults to HTTP/1.0 and can lead to responses without this header. There is a debate on whether including theContent-Length
header is beneficial, given that Node.js cannot sendTransfer-Encoding
headers to HTTP/1.0 clients. The original poster mentions that while they have worked around the issue by configuring Nginx to use HTTP/1.1, they reported it due to the inconsistency and the time it took to diagnose the problem. - Number of comments this week: None
- The comments discuss the implications of the missing
-
Only print failing assertion once with spec reporter: This issue addresses the problem of the
spec
test runner reporter in Node.js printing identical error messages twice, which results in unnecessarily verbose output that complicates the inspection of test failures. The proposed solution is to modify the reporter to print each unique test failure only once, thereby streamlining the output and improving the user experience during node core development.- The comments reflect a consensus on the need to print each failure only once, with contributors agreeing on keeping the last occurrence of the failure in the output. There is a discussion about the possibility of creating a custom reporter for node core, but the change is considered beneficial for general use. One contributor expresses intent to work on the issue soon.
- Number of comments this week: None
-
Cross-compilation bug when compiling for loongarch64 on a non-loongarch64 host with Linux: This issue involves a cross-compilation bug encountered when attempting to compile for the loongarch64 architecture on a non-loongarch64 host running Linux. The problem manifests as undefined references during the linking stage, preventing successful compilation of the project.
- The comments discuss an initial incorrect assumption that a specific pull request fixed the issue, followed by clarification that the problem is unrelated to that pull request. A user provides additional context by sharing a related error log from a different build attempt, highlighting issues with architecture-specific declarations. The conversation concludes with an apology for the confusion.
- Number of comments this week: None
2.2 Top 5 Stale Issues:
We consider stale issues to be issues that has had no activity within the last 30 days. The team should work together to get these issues resolved and closed as soon as possible.
As of our latest update, there are no stale issues for the project this week.
2.3 Open Issues
This section lists, groups, and then summarizes issues that were created within the last week in the repository.
Issues Opened This Week: 14
Summarized Issues:
- Node.js Stream Handling Issues: Several issues have been reported regarding stream handling in Node.js, affecting both Writable and Readable streams. The
desiredSize
property of aWritableStream
does not reflect the expected value, leading to buffer queue expansion. Additionally, the.pipe()
and.pipeTo()
methods fail with errors when the source stream is constructed from a Buffer, causing locked ReadableStreams or invalid argument type errors.
- Cross-Compilation and Architecture-Specific Bugs: Node.js faces challenges with cross-compilation and architecture-specific issues. A persistent bus error occurs when building the
mksnapshot
tool on the mips64el architecture. Similarly, cross-compilation for the loongarch64 architecture results in undefined reference errors during the build process.
- HTTP Header and Proxy Issues: Node.js servers have inconsistencies in handling HTTP headers, particularly with HTTP/1.0 responses missing the
Content-Length
header. This absence can lead to issues when using Nginx as a reverse proxy, as it defaults to HTTP/1.0 for upstream requests. The inconsistency between HTTP/1.0 and HTTP/1.1 responses complicates server configurations.
- Module and Function Export Issues: Problems arise when converting Node.js modules from CommonJS to ECMAScript Module format. Functions exported using
Object.defineProperty
are not accessible as expected, particularly affecting dynamic functions and thenodejs/cjs-module-lexer
and TypeScript'sesModuleInterop
feature. This issue highlights the challenges in module interoperability.
- Performance and Execution Problems: Node.js exhibits performance issues and execution anomalies in specific scenarios. Copying large files over a network is significantly slower compared to other tools like Bun. Additionally, an Immediately Invoked Async Function Expression fails to execute properly in certain Node.js versions, leading to process termination.
- Testing and Debugging Output Issues: The
spec
test runner reporter in Node.js prints identical error messages twice for a single test failure. This redundancy results in verbose output, complicating the debugging process. A proposed solution aims to streamline the output by printing each failure detail only once.
- File Matching and Glob Pattern Bugs: Node.js has a bug where using the globstar (
**
) in a glob pattern fails to match dot files. This behavior is inconsistent with the expected results from node-glob and bash, where dot files are matched as requested. The issue highlights discrepancies in file matching logic.
- Security and Version Updates: An update to npm version 11.0.0 is necessary to address a security vulnerability in the current version 10.9.2. This update is crucial for maintaining security standards and ensuring the safety of Node.js applications.
- Command-Line Parameter Functionality: Node.js version 22.12.0 on macOS has a bug where the
--watch-preserve-output
parameter does not function as expected. The screen is cleared upon server restart, unlike in previous Node.js versions where the parameter worked correctly. This issue affects the usability of command-line tools.
2.4 Closed Issues
This section lists, groups, and then summarizes issues that were closed within the last week in the repository. This section also links the associated pull requests if applicable.
Issues Closed This Week: 29
Summarized Issues:
- Node.js Environment Variables and Task Runners: The Node.js task runner (
node --run
) lacks the ability to set thenpm_lifecycle_event
environment variable, which is essential for task runners like Wireit to determine the correct script to execute. This issue highlights the disparity between Node.js and other package managers like npm, Yarn, and pnpm, which already support this feature. The discussion includes potential solutions and additional environment variables that could enhance compatibility and functionality.
- Node.js Documentation and Method Usage: There is a proposal to document the methods
process.channel.refCounted()
andprocess.channel.unrefCounted()
in Node.js, which are crucial for managing child process lifecycles without affecting automatic reference counting. This documentation is necessary to prevent unintended early termination of processes when using IPC in libraries like Execa. Proper documentation would help developers understand and utilize these methods effectively.
- Error Handling and Reporting in Node.js: Intermittent
UNKNOWN
write errors in a webpack-based build system on Windows are caused by a loss of error information inlibuv
. Enhancing error reporting by including the actual system error using theuv_fs_get_system_error
API is proposed to improve debugging and reduce wasted pipeline time. This improvement would provide developers with more accurate error information, facilitating quicker resolutions.
- Node.js Test Coverage and Reporting: The current Node.js project setup includes all test files in the coverage metrics, which skews the accuracy of the coverage report. There is a proposal to automatically exclude files with a
.test.*
pattern from the coverage report to improve its accuracy. This change would ensure that only relevant files are included in the coverage metrics, providing a clearer picture of the project's test coverage.
- File System Event Reporting on Windows: Inconsistent event reporting occurs when using recursive
fs.watch
on a Windows directory junction, where "change" events for a parent directory are only triggered if an external process is actively observing the directory. This suggests a potential bug or limitation in the Windows API rather than in Node.js itself. Addressing this issue would improve the reliability of file system event reporting on Windows.
- Node.js TypeError and Deprecated Methods: A TypeError occurs in Node.js version 20.15 when using the deprecated
Buffer()
constructor inside anew Promise()
, which does not occur in version 20.14. This issue is related to a deprecation check that fails by attempting to read properties of a null value. Resolving this issue would ensure consistent behavior across Node.js versions.
- Node.js execSync and stdio Options: The
execSync
function in Node.js unexpectedly preventsstderr
from being printed when thestdio
option is set topipe
, despite documentation indicating thatpipe
is the default behavior. Users suggest an option to suppressstderr
output while retaining detailed exception information. Addressing this discrepancy would align the function's behavior with user expectations and documentation.
- Flaky Tests in Node.js on Windows: The
test-runner-watch-mode-complex
test intermittently fails on the Windows platform due to an assertion error where the test output does not match the expected regular expression. However, it has not failed since a related pull request was merged in September. This suggests that the issue may have been resolved, but further monitoring is necessary to confirm stability.
- Uncatchable Errors in Node.js Streams: An uncatchable error occurs when piping data between streams in Node.js with mismatched
objectMode
settings, leading to aTypeError
. It is suggested that a synchronous error should be thrown during theReadable.pipe()
call to prevent this issue. Implementing this change would improve error handling and prevent unexpected application crashes.
- Node.js util.aborted Function Clarification: There is a need for clarification on the usage and purpose of the second argument,
resource
, in theutil.aborted
function from Node.js documentation. Concerns include its necessity, correct application, and potential memory leaks if not used properly. Providing clear documentation would help developers use this function correctly and avoid unintended issues.
- Electron Compatibility with Node.js on Windows: The Electron Demo (version 29.4.1) fails to run on Windows 10/11 when the NULL service is stopped or removed, whereas older Electron versions like 22.0 do not encounter this problem. This suggests a potential system issue or a compatibility problem between Electron and Node.js. Identifying and resolving the root cause would ensure consistent application performance across different environments.
- Node.js ES Modules and Native Addons: There is a proposal to add support for using
import('./native.node')
in Node.js ES modules to load native addons, aiming to achieve full parity with therequire()
function. Considerations include whether import assertions should be mandated for this feature. Implementing this support would enhance module system ergonomics and developer experience.
- Node.js Web Streams Subsystem Bug: A bug in the Node.js web streams subsystem involves an exception being caught when attempting to call an undefined function for determining chunk size. It is suggested that a check for undefined should be implemented to prevent the error from occurring. Addressing this issue would improve the robustness of the web streams subsystem.
- Node.js dns.lookup Functionality on Windows: In Node.js v22.12 on Windows, the
dns.lookup('localhost', { all: true })
function only returns the IPv6 address::1
, unlike previous versions that returned both IPv6 and IPv4 addresses. This causes connection failures for applications expecting dual address resolution. Restoring the previous behavior would ensure compatibility with existing applications.
- Node.js SQLITE_CHANGESET_* Constants Organization: There is a proposal to organize
SQLITE_CHANGESET_*
constants under aconstants
namespace within the experimentalnode:sqlite
module. This would prevent module scope pollution, similar to how other modules likeos
andvm
handle their constants. Implementing this change would improve module organization and maintainability.
- Node.js Heap Snapshot Management: The
--heap-snapshot-on-oom
parameter in Node.js should respect the--diagnostic-dir
parameter, similar to--heapsnapshot-near-heap-limit
. This would facilitate easier management of heap dump files by allowing them to be directly saved to a specified directory. Implementing this feature would streamline the process of managing diagnostic data.
- Node.js Documentation and Linting Process: Adding checks for documentation placeholders to the lint-release-proposal workflow in the Node.js project is proposed to prevent issues during the release build process on Jenkins. This would ensure that all necessary documentation is in place before a release, reducing the risk of incomplete or incorrect documentation being published.
- Node.js URL Handling on Windows: A bug in Node.js causes the
new URL()
function to incorrectly removelocalhost
when working with UNC paths on Windows, resulting in broken URLs. Preservinglocalhost
as the host name would ensure that URLs remain valid and accessible. Fixing this issue would improve the reliability of URL handling in Node.js.
- Node.js EventEmitter.listeners() Method: A TypeError occurs when the
.listeners()
method of anEventEmitter
instance is called without arguments, due to an undefined property. The expected behavior is to return an empty array, which would prevent errors and ensure consistent functionality. Addressing this issue would improve the reliability of theEventEmitter
class.
- Node.js require(esm) Error Handling: Using
require(esm)
within atry/catch
block in Node.js not only logs the caught error but also generates an unhandled rejection. This unexpected behavior suggests that the error should be fully handled by thetry/catch
mechanism. Resolving this issue would align error handling with developer expectations.
- Node.js Linting Process on M1 Platform: The linting process in version v24.0.0-pre on an M1 platform consistently fails due to multiple syntax errors related to the missing
node:
prefix in a documentation file. This results in 61 errors and an additional error indicating that YAML linting is unavailable. Addressing these issues would ensure a smooth linting process across different platforms.
- JavaScript Date.prototype[Symbol.toPrimitive] Modification: A user attempts to override the
toPrimitive
method of the Date class in JavaScript, expecting the custom method to be invoked. However, the defaulttoPrimitive
method is called due to the non-writable nature ofDate.prototype[Symbol.toPrimitive]
. UsingObject.defineProperty
to modify it would allow for the desired behavior.
- Node.js ESM Project Import Behavior: An ESM project cannot import named functions from the
bloom-filters
package when added vianpm add
, but can do so when using the file protocol. This highlights a discrepancy between expected and actual import behavior. Resolving this issue would ensure consistent import functionality across different methods.
- Node.js TypeScript Transform Errors: A bug in the Node.js project causes TypeScript transforms to fail when the source file path contains certain special characters, leading to a
TypeError
. This should not cause the test runner to crash, and addressing this issue would improve the robustness of the TypeScript integration.
- Node.js HTTP/2 Subsystem Bug: Numerous streaming and aborted HTTP/2 requests in quick succession cause the server to send a GOAWAY signal after approximately 1000-1200 requests. Adjusting the rate limiting options in the server configuration can mitigate this, but may expose the server to rapid reset attacks. Addressing this issue would improve the stability of the HTTP/2 subsystem.
- Node.js .tsx File Extension Support: There is a proposal to support
.tsx
file extensions in Node.js, allowing for type stripping without JSX compilation. This aims to maintain consistency in monorepos that share code between client and backend, but faces opposition due to concerns about misusing the.tsx
extension. Addressing these concerns would ensure a balanced approach to supporting this feature.
- Node.js ERR_INTERNAL_ASSERTION Error: A recurring "ERR_INTERNAL_ASSERTION" error occurs almost every time a server starts, potentially due to a bug in Node.js version 18.15.0 or incorrect usage of its internals. The bug is fixed in Node.js 20.12+, suggesting that the error might originate from an outdated Electron app using an older Node.js version. Updating to a newer version would resolve this issue.
- Node.js Test Flags Discrepancy: There is a discrepancy in the behavior of the
--test
and--test-only
flags in a Node.js project, where the--test-only
command fails to locate test files using a glob pattern. This leads to confusion about which tests are actually executed. Addressing this issue would ensure consistent and predictable test execution.