-
Notifications
You must be signed in to change notification settings - Fork 286
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
os.userInfo is not a function #51
Comments
This will only be called if you don't set the user in any of the other ways. Isn't that an option for you? const sql = postgres({
username: 'your user'
}) |
Yes :) I have only stumbled upon this because I have incorrectly used env variable. But it seems more appropriate to give user some more readable error then this. But do what you will, its not that big of a deal :) |
Ah I see.. Goodie :) Doesn't the stack trace give a proper indication of the error? Mind posting the entire stack trace for the error? It's a lot of custom error handling which might even lead to brittle errors instead if I tried to handle this specific scenario. Do you have ideas for how to handle it better? |
This is the error: As for how to handle it: I dont think there is other way to handle it without try/catch, so other options are just variants of try and catch. |
Ah, I see what you mean, that's pretty obvious ;) Fixed |
postgres/lib/index.js
Line 493 in 7a4ef4b
Node v12.13.0
OS: Windows 10
Usage: inside Electron + React
Anyway this line is giving me error - TypeError: os.userInfo is not a function.
As per SO question and answer -> https://stackoverflow.com/a/56253238 os.userInfo() cant be called from browser.
One solution is deleting os.userInfo().username and replacing it with empty quotes, which i did in my project. User should be able to put username inside env var or options.
The text was updated successfully, but these errors were encountered: