Skip to content

no home environment when run on lambda #11

Description

@edmamerto

When dogscaler client is run on lambda, the logical way to do this is store your ruby libraries in a lambda layer and call the dogscaler binary from the lambda layer path.

When calling the client as if we were running it in the terminal like this:

def lambdaHandler(event:, context:)
	output = `/opt/2.5.0/bin/dogscaler`
	p output
end

I get this error:

/opt/2.5.0/gems/dogscaler-2.0.10/lib/settings.rb:31:in expand_path': couldn't find login name -- expanding ~' (ArgumentError)

Solution is to set a home dir when it's nil

if ENV['HOME'].nil?
  require 'etc'
  ENV['HOME'] = Etc.getpwuid.dir
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions