Skip to content

Serious issue with NAPI_VERSION being set to 3 on 8.x branch while features are missing #330

Closed

Description

@rolftimmermans

I am writing an N-API integration that uses an node::AtExit callback hook, and I intend to use N-API for that.

The documentation of napi_add_env_cleanup_hook https://nodejs.org/api/n-api.html#n_api_napi_add_env_cleanup_hook states this was added in N-API version 3.

However, Node.js 8.11 is missing this function even though it advertises support for N-API version 3.

I do not understand why Node 8 should have N-API version 3, but most of all I'm incredibly surprised by the mismatch between N-API versions and actually exported N-API functions.

I know versions 1-2 were sort of messy, but I definitely expected all N-API version 3 functions to be present if NAPI_VERSION is set to 3.

What is the purpose of NAPI_VERSION if it cannot be used to detect new additions?

Can someone please advise what the best way forward is for module authors like me.

Activity

  1. gabrielschulhof commented on Aug 21, 2018

    @gabrielschulhof
    Collaborator
  2. kfarnung commented on Aug 22, 2018

    @kfarnung
    Contributor

    @rolftimmermans Thanks for the report. Unfortunately NAPI_VERSION 3 was created without a formal process for accepting new APIs and promoting them. That process has been documented now so this should not be an issue going forward.

    Thanks @gabrielschulhof for opening the backport PR!

  3. mhdawson commented on Aug 22, 2018

    @mhdawson
    Member

    Just to add to the comments from @kfarnung, what I understand happened was that a new API was added to master and then backported to 10.X without bumping the NAPI_VERSION which should have been the case. This meant that it would be SemVer major to remove it from 10.X.

    The new guidance and use of an experimental phase should prevent this from occurring again.

    @gabrielschulhof it will need a backport to both 8.x and 6.x to completely close the gap.

  4. gabrielschulhof commented on Aug 22, 2018

    @gabrielschulhof
    Collaborator
  5. mhdawson commented on Nov 15, 2021

    @mhdawson
    Member

    Looks like backport PR landed and we have improved the handling of how new functions are added since Node-API went stable. Closing, please let us know if you think that was not the right thing to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions