Skip to content

napi_create_external_arraybuffer implementation requires upward/circular dependency #49522

@sparist

Description

@sparist

Version

18.x-staging head

Platform

No response

Subsystem

Node-API

What steps will reproduce the bug?

Using only the JS portion of the Node API, call napi_create_external_arraybuffer() and note that the ERR_BUFFER_CONTEXT_NOT_AVAILABLE error results.

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

The expected behaviour is that functions in the JS-only portion of the Node API can be called without requiring the entire Node environment; this breaks separation of concerns.

What do you see instead?

The following change introduced an upward JS Node API dependency on the Node API:

#32463

For consumers of the JS-only API who don't use the Node portion of the Node API, calling napi_create_external_arraybuffer results in ERR_BUFFER_CONTEXT_NOT_AVAILABLE.

Reverting the change in the above linked issue caused napi_create_external_arraybuffer to again work correctly.

Because the API implementation has deviated significantly since then, it has become impossible to keep my fork up-to-date, even to the tip of 18.x-staging.

Requesting that this be implemented in JS Node API without requiring an upward dependency on Node API, as it was prior to the above change. This decision makes the JS Node API unusable without all of Node, affects my ability to use Node-API (and requires me to use an old fork), and is a generally broken architectural design.

Failing that, [a] workaround[s] that I can apply to keep my fork up-to-date.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    node-apiIssues and PRs related to the Node-API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions