fix(nodejs): treat NAPI_RS_FORCE_WASI as truthy only when set to 'true'#3519
Merged
wjones127 merged 1 commit intoJun 9, 2026
Merged
Conversation
Upgrade @napi-rs/cli from 3.5.1 to 3.7.0, which fixes the truthy string check in the generated native.js loader. Previously, setting NAPI_RS_FORCE_WASI=false caused the WASI fallback to trigger because any non-empty string is truthy in JavaScript. The fix in napi-rs/[email protected] uses an explicit comparison (=== 'true' || === 'error'), so only the literal string 'true' activates the WASI path. Closes lancedb#3267
westonpace
approved these changes
Jun 9, 2026
wjones127
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
NAPI_RS_FORCE_WASI=falseissue by upgrading@napi-rs/clifrom3.5.1to3.7.0.Closes #3267
Root Cause
In the
native.jsloader generated bynapi build, the check was:In JavaScript, any non-empty string is truthy, so
NAPI_RS_FORCE_WASI=false(a non-empty string) inadvertently triggered the WASI fallback path. This caused anENOENTerror whenlancedb.wasi.cjswas not present.Fix
@napi-rs/[email protected](napi-rs/napi-rs#3236) introduced a tri-state check in the template that generatesnative.js:Before (generated by @napi-rs/[email protected]):
After (generated by @napi-rs/[email protected]):
Only the literal string
'true'(or'error'for strict mode) now activates the WASI path. All other values, including'false','0', or an unset variable, behave as if WASI is not forced.Changes
nodejs/package.json: bump@napi-rs/clifrom3.5.1to3.7.0nodejs/package-lock.json/nodejs/pnpm-lock.yaml: update lock files to matchThe fix is in the upstream napi-rs tool; the generated
native.jsis not committed to this repository and is produced at build time bynapi build.