-
Notifications
You must be signed in to change notification settings - Fork 440
Error: Cannot find module 'env' #1100
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
Comments
Update: I tried copying the exact same content of the |
Okay, found where this originates. It was really painful to troubleshoot and find this. Turns out it comes from the user.password = hash(password.trim(), DEFAULT_COST).unwrap().to_string(); I'm trying to patch this myself, and eventually use another solution if I am not able to get this working. Will update soon. |
Update: Tried replacing Just check out the implementation that I did in my 2 latest commits if that interests you.
|
Hey so I had this issue with this (was ~8 months ago) but the issue was around |
Hey @simlay, thanks for the info but I really don't believe I'm currently facing this issue because of the |
Update: Got an idea upon waking up to use the wasm bridge to call the hashing and verifying function for storing passwords from JS instead. It was either that or implementing my own hashing algorithm (aka bad idea). So I did that, completely removed the #[wasm_bindgen]
extern "C" {
// #[wasm_bindgen(method, js_name = hash)]
fn hash(s: &str, salt: &str) -> String;
// #[wasm_bindgen(method, js_name = verify)]
fn verify(s: &str, hash: &str) -> usize;
} After compiling the code down to wasm, I found that I still had the initial error and I am sure that it is linked to the functions related to hash/verify passwords itself since upon removing calls to parts of the code doing this, I ceased to have initial issue with the wasm://wasm/002f3a3a:1
RuntimeError: unreachable
at wasm://wasm/002f3a3a:wasm-function[300]:0x49c84
at wasm://wasm/002f3a3a:wasm-function[776]:0x5b4bd
at wasm://wasm/002f3a3a:wasm-function[887]:0x5d54d
at wasm://wasm/002f3a3a:wasm-function[509]:0x541ce
at wasm://wasm/002f3a3a:wasm-function[904]:0x5d832
at wasm://wasm/002f3a3a:wasm-function[91]:0x2fc0a
at wasm://wasm/002f3a3a:wasm-function[234]:0x41e99
at wasm://wasm/002f3a3a:wasm-function[302]:0x49ff6
at module.exports.save_users (/home/edgeking810/Documents/Rust/kinesis-db/pkg/kinesis_db.js:417:10)
at file:///home/edgeking810/Documents/Rust/kinesis-db/api/index.js:41:18
Node.js v17.2.0 In conclusion, I find Rust to be already powerful enough to do what I want it to do and I think I've got the time to learn and build the API in Rust itself. I was initially against this since I have more knowledge in building APIs in JS than Rust but at this point, I can't trust the wasm bridge enough to have the peace of mind of running a prod API using this technology. It is going to be fun learning about Rocket nonetheless and I hope to have a really robust API by the end. If anyone wants to try out and troubleshoot what I did, I made a branch just about it: https://github.com/EdgeKing810/kinesis-db/tree/wasm. It only needs running the |
@EdgeKing810 do you have any tips on how to identify code that might be causing |
@MatthewHerbst Unfortunately, you just have to comment out parts of the code block by block and running a |
For tracking down the offending imports, you can use
|
🐛 Bug description
After running a
wasm-pack build --release --target nodejs
, when importing the generated js file from thepkg/
folder in a NodeJS app, I'm getting the following error:🤔 Expected Behavior
This line should not be in the generated js file:
I do not know if this should be replaced by something else but it sure doesn't work by just removing this line.
👟 Steps to reproduce
Easiest way to reproduce this would be to execute the following commands:
Full error when doing a
import pkg from '../pkg/kinesis_db.js';
in my NodeJS app:I tried using other flags such as
--dev
or--debug
but I face the same problem. Building without the--target nodejs
flag is not feasible for me since I'll be using this wasm build in a NodeJS backend app, not for a frontend application with a bundler such as Webpack.🌍 My environment
Tried using the latest nightly Rust build too.
Additional
This issue has initially been raised in #743, I'm just creating a new issue because this is a really blocking problem. I tried other solutions such as
rustwasmc
too but they all have some kind of issues.Here's the
Cargo.toml
file I'm using as well in case that helps:FYI, I've tried tweaking the
profile.release
section multiple times by adding/removing thelto = true
line, and 'unsetting' theopt-level
variable or by giving it the value"s"
+ testing with multiple flags.Happy New Year 🌃 in advance and I hope we get a fix soon for this issue 🤞. Very grateful if anyone could help on this, thanks in advance!
The text was updated successfully, but these errors were encountered: