-
Notifications
You must be signed in to change notification settings - Fork 75
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
Unhandled error when initializing client for unknown user #35
Labels
Comments
Ai, thanks. Fortunately it should be easy to provide a fix for this one! |
ivarconr
pushed a commit
that referenced
this issue
Apr 27, 2017
ivarconr
added a commit
that referenced
this issue
Apr 27, 2017
Unleash initalize should not fail when os.userInfo() throws #35
fixed in 2.1.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was discovered while running autotests for our app so is probably not critical to production.
If the Unleash client is initialized without specifying an
instanceId
then the client will attempt to generate one usingos.userInfo
andos.hostname
. This can result in an unhandled error in some cases becauseos.userInfo
will throw an error if the user running the process does not have an entry in the/etc/passwd
file on *nix systems. Here is a stack trace from our app:See
GetUserInfo
in Node's os module:https://github.com/nodejs/node/blob/master/src/node_os.cc#L354
Since there is already a fallback for the case where
info.username
is empty, it probably makes sense to put a try/catch around the call to userInfo() and ensure the fallback gets used if an error is thrown.In the meantime, the workaround is simply to pass in a
instanceId
when initializing Unleash.The text was updated successfully, but these errors were encountered: