sengaya / aws-micro-cli

Minimalist Command Line Interface for Amazon Web Services
GNU General Public License v3.0
5 stars 0 forks source link

`/aws-micro: line 745: HOME: unbound variable` when calling `aws-micro s3api head-object` #15

Open mzy2240 opened 1 day ago

sengaya commented 1 day ago

Could you provide an example as well as information about your system? is $AWS_CONFIG_FILE set? is $HOME set?

mzy2240 commented 1 day ago

Im using the latest debian:bullseye-slim docker image. I do have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY properly set as environment variables, and because I'm running inside the AWS lambda so I assumed I dont need to explicitly set up $AWS_CONFIG_FILE?

mzy2240 commented 1 day ago

Is $HOME required?

sengaya commented 12 hours ago

That's surprising... would you mind sharing your full command?

Usually, $HOME is automatically set, e.g. if you run debian:bullseye-slim docker image as root it is set to /root. AWS_CONFIG_FILE is not required and anyway only used by the --profile option at the moment. I might be able to change it in a way that it only fails when really needed.

It would be also helpful if you could share the aws cli output in your environment. I am not sure if this is possible as you run inside a lambda?

sengaya commented 12 hours ago

According to https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime it looks like lambda does not set $HOME. I need to think about how to address this. As a workaround, I think it should work if you simply set HOME to some directory, e.g. export HOME=/tmp/foo.

sengaya commented 6 hours ago

I followed https://docs.aws.amazon.com/sdkref/latest/guide/file-location.html and v0.4.1 (just released) uses now ~ instead of $HOME. Let me know if that fixes your issue.