alestic / lambdash

Lambda shell - Run sh commands inside AWS Lambda environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: 'stdout' when running lambdash

dtenenba opened this issue · comments

I installed lambdash and as mentioned in another issue and in the CloudFormation output of my first attempt, I had to change Runtime from nodejs4.3 to nodejs8.10. I realize that could cause some issues but I don't think the issue I am running into is related to the runtime; it's a python issue.

My stack was created successfully. After exporting LAMBDASH_FUNCTION , I ran lambdash and got this:

$ ./lambdash
Traceback (most recent call last):
  File "./lambdash", line 19, in <module>
    os.write(sys.stdout.fileno(), base64.b64decode(result['stdout']))
KeyError: 'stdout'

Same with python3:

$ python3 ./lambdash
Traceback (most recent call last):
  File "./lambdash", line 19, in <module>
    os.write(sys.stdout.fileno(), base64.b64decode(result['stdout']))
KeyError: 'stdout'

I have boto3 installed in both pythons.

Seems like the problem is that the call to invoke LAMBDASH_FUNCTION is returning an error:

In [10]: result
Out[10]: {u'errorMessage': u'RequestId: f8b38d9d-5758-4125-b220-1b12e8021bec Process exited before completing request'}

In [11]: response['FunctionError']
Out[11]: 'Unhandled'

So result only has the key errorMessage, not stdout and stderr.

Thanks for reporting this.

I haven't examined this code in years, but if somebody has ideas on how to fix the issue, I'll take a look.

@dtenenba you need to pass a command to lambdash, i.e. ./lambdash echo foo