Skip to content
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

This gem is failing on environment without HOME (like AWS Lambda) #25

Closed
jpalumickas opened this issue Apr 1, 2020 · 4 comments · Fixed by #30
Closed

This gem is failing on environment without HOME (like AWS Lambda) #25

jpalumickas opened this issue Apr 1, 2020 · 4 comments · Fixed by #30
Assignees
Labels

Comments

@jpalumickas
Copy link

I try to use this gem on AWS Lambda and I get this error. It's failing to get Dir.home

couldn't find login name -- expanding `~'

/var/task/vendor/bundle/ruby/2.7.0/gems/sym-2.8.5/lib/sym/constants.rb:21:in `home'
/var/task/vendor/bundle/ruby/2.7.0/gems/sym-2.8.5/lib/sym/constants.rb:21:in `register_bash_extension'
/var/task/vendor/bundle/ruby/2.7.0/gems/sym-2.8.5/lib/sym/constants.rb:13:in `block in register_bash_files!'
@kigster
Copy link
Owner

kigster commented Jun 3, 2020

Great find, thanks for logging!

@kigster kigster self-assigned this Jun 3, 2020
@kigster kigster added the OS/linux Linux label Jun 3, 2020
kigster added a commit that referenced this issue Aug 15, 2020
We only use `Dir.home` in a couple of places, so
it's not a bit deal to allow user_home to be overridden.

This is now possible via the --user-home/-u [DIR] flag.

[fixes #25]
@kigster
Copy link
Owner

kigster commented Aug 15, 2020

I decided to solve this issue by giving you a new CLI flag — --user-home or -u DIR will allow everything to work without breaking. So for all invocations of sym you must supply this on AWS.

However, you can also add it to your $SYM_ARGS variable and pass -A to sym instead. That way you can always add more flags from a single source: environment variable.

kigster added a commit that referenced this issue Aug 15, 2020
* Refactor and changes to support custom user_home.

We only use `Dir.home` in a couple of places, so
it's not a bit deal to allow user_home to be overridden.

This is now possible via the --user-home/-u [DIR] flag.

[fixes #25]

* Tweak to an example.

* Support for AWS Lambda and envs without $HOME

* Fixing flakey test
@jpalumickas
Copy link
Author

@kigster I think Lambda does not have user-home dir at all, so we can pass empty user home?

@kigster
Copy link
Owner

kigster commented Aug 17, 2020

@jpalumickas You can pass whatever you like, but it must be a valid directory. Honestly, this is ONLY used for -B flag when installing BASH completion. For all other operations it doesn't really matter. Still, I would suggest using a writeable folder, like /tmp if you are able. If not, just use / (empty will not be accepted by the CLI parser).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants