Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

napi: returning value from initializer is ignored #17349

Closed
bartlomieju opened this issue Jan 11, 2023 · 3 comments · Fixed by #17502
Closed

napi: returning value from initializer is ignored #17349

bartlomieju opened this issue Jan 11, 2023 · 3 comments · Fixed by #17502
Assignees
Labels
bug Something isn't working correctly node compat node native extension related to the node-api (.node)

Comments

@bartlomieju
Copy link
Member

No description provided.

@bartlomieju bartlomieju added bug Something isn't working correctly node compat node native extension related to the node-api (.node) labels Jan 11, 2023
@bartlomieju bartlomieju self-assigned this Jan 11, 2023
@littledivy
Copy link
Member

It's not ignored. the C++ macro NODE_API_MODULE expands to the proper register function https://github.com/nodejs/node-addon-api/blob/fdc6263034cf8b16a4a61f9fef1b660494e1b280/napi-inl.h#L342-L345

@bartlomieju
Copy link
Member Author

I'm pretty sure we can't handle a case like this:
https://github.com/nodejs/node/blob/e48763840625c037282681456ecd1e1cb034f636/test/js-native-api/test_constructor/test_constructor.c#L161

Here's the relevant that handles this:
https://github.com/nodejs/node/blob/e48763840625c037282681456ecd1e1cb034f636/src/node_api.cc#L671-L678

@POPPIN-FUMI
Copy link

@littledivy Thank you for fixing this issue!
I am Kawasaki from EpicsDAO,
We empower open-source software development.
This quest is related to Epics Alpha's quest.
So you get 3000$EPCT as a reward if you submit this PR link to this platform
https://alpha.epics.dev/en/quest/UXVlc3Q6MTM2/

Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat node native extension related to the node-api (.node)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants