Open WingZer0o opened 4 months ago
NAPI is not supported on Deploy, that is correct. Deploy does not support suprocesses or node addons.
Are you using a binary built for Windows on Windows (and not accidentially a Linux binary?). Does it work on Windows in Node?
This wasn't being done in deploy this was being done on my local machine. Its not a very popular library so usage would be low so I imagine its not a major priority. It shouldn't be another platform binary because I was under the assumption @napi-rs builds for the target system that you are on. But yes this does work on Windows for node. Example below.
import {AESWrapper} from "cas-typescript-sdk";
const aes = new AESWrapper();
const nonce = aes.generateAESNonce();
const key = aes.aes256Key();
const encoder = new TextEncoder();
const tohashBytes: Array<number> = Array.from(encoder.encode("sometestemail@outlook.com"));
const encrypted = aes.aes256Encrypt(key, nonce, tohashBytes);
const decrypted = aes.aes256Decrypt(key, nonce, encrypted);
const decoder = new TextDecoder();
const decoded = decoder.decode(new Uint8Array(decrypted));
console.log(decoded);
@WingZer0o if you rename node.exe
to something else does it break in node as well?
I don't have a node.exe in my current library, I have an index.node that is compiled from @napi-rs is that what you are referring to?
On Mon, Jun 17, 2024 at 1:50 AM snek @.***> wrote:
@WingZer0o https://github.com/WingZer0o if you rename node.exe to something else does it break in node as well?
— Reply to this email directly, view it on GitHub https://github.com/denoland/deno/issues/23465#issuecomment-2172340656, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEG2SNFH4YYCD3NLA4AB2GTZHZ2JLAVCNFSM6AAAAABGP6D7ZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZSGM2DANRVGY . You are receiving this because you were mentioned.Message ID: @.***>
@WingZer0o I mean, on the windows computer you are running this on, when you run your code with Node.js, you're presumably using a node.exe
binary. Can you try renaming it to something else and running your code? I believe this is due to an issue where native modules link against "node.exe"
rather than the current process (so renaming node.exe to something else would trigger the same issue you see in deno.exe). node-gyp
has a fix for this (https://github.com/nodejs/node-gyp/blob/main/src/win_delay_load_hook.cc) but napi-rs
does not.
Version: deno 1.42.4 (release, x86_64-pc-windows-msvc)
My personal cryptographic NPM package
npm:cas-typescript-sdk
that creates Rust bindings to a TS lib through @napi-rs/cli seems to be working fine on Debian in WSL. However, when running on Windows or attempting to deploy the project to deploy I get the following error(s).Perhaps this is an error in the way I constructed my NPM package? I am not the most experienced with crafting NPM packages and Deno.
No rush or anything, Would be happy to help investigate the issue or possibly submit a PR if the issue is not with my lib.
Windows Error
Deploy Error
index.ts
router-one.ts
Compiled TS file where the error points to