Well, it looks like AWS has changed a bit… I think I managed to muddle my way though it. However when doing a test I get “Unable to import module ‘lambda_function’”
I THINK this may have to do with the fact I was unable to change the handler when I uploaded the zip file (assuming I uploaded the zip file correctly. In videos I say people got a “function code” box, I was only able to get a “source code” box) This may have been because I was unable to click on the “Hasska” in the function overview, I had to click on “Layers.” Which may have had to do with the fact then when I clicked “Add trigger” I had no option to enable it… (But I assume it was enabled, cause finally, everything else worked."
Any idea what may be going on?
same issue
I had the same issue. While I am still having other issues, I was able to resolve the issue you described. I was getting the same error because the Handler was not updated. While the haaska directions are GREAT there have been some changes to AWS. Try scrolling down to the Runtime Settings and change the handler to haaska.event_handler. That resolved the issue for me.
I tried changing that handler as you described, but that created a whole new set of errors.
The original error is:
Test Event Name
Myfirsttest
Response
{
“errorMessage”: “Unable to import module ‘lambda_function’: No module named ‘lambda_function’”,
“errorType”: “Runtime.ImportModuleError”,
“requestId”: “72bb97e6-873e-4154-9389-03a30daef97a”,
“stackTrace”: []
}
Function Logs
START RequestId: 72bb97e6-873e-4154-9389-03a30daef97a Version: $LATEST
[ERROR] Runtime.ImportModuleError: Unable to import module ‘lambda_function’: No module named ‘lambda_function’
Traceback (most recent call last):END RequestId: 72bb97e6-873e-4154-9389-03a30daef97a
REPORT RequestId: 72bb97e6-873e-4154-9389-03a30daef97a Duration: 11.30 ms Billed Duration: 12 ms Memory Size: 128 MB Max Memory Used: 35 MB Init Duration: 118.82 ms
Request ID
72bb97e6-873e-4154-9389-03a30daef97a
If I change the handler I get the following:
Test Event Name
Myfirsttest
Response
{
“errorMessage”: “HTTPConnectionPool(host=‘localhost’, port=8123): Max retries exceeded with url: /api/alexa/smart_home (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x7f681e89e1d0>: Failed to establish a new connection: [Errno 111] Connection refused’))”,
“errorType”: “ConnectionError”,
“requestId”: “abfa1fb0-887f-41e7-b664-cd9d165e08b0”,
“stackTrace”: [
" File “/var/task/haaska.py”, line 111, in event_handler\n return ha.post(‘alexa/smart_home’, event, wait=True)\n",
" File “/var/task/haaska.py”, line 63, in post\n r = self.session.post(self.build_url(endpoint),\n",
" File “/var/task/requests/sessions.py”, line 581, in post\n return self.request(‘POST’, url, data=data, json=json, **kwargs)\n",
" File “/var/task/requests/sessions.py”, line 533, in request\n resp = self.send(prep, **send_kwargs)\n",
" File “/var/task/requests/sessions.py”, line 646, in send\n r = adapter.send(request, **kwargs)\n",
" File “/var/task/requests/adapters.py”, line 516, in send\n raise ConnectionError(e, request=request)\n"
]
}
Function Logs
START RequestId: abfa1fb0-887f-41e7-b664-cd9d165e08b0 Version: $LATEST
[ERROR] ConnectionError: HTTPConnectionPool(host=‘localhost’, port=8123): Max retries exceeded with url: /api/alexa/smart_home (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x7f681e89e1d0>: Failed to establish a new connection: [Errno 111] Connection refused’))
Traceback (most recent call last):
File “/var/task/haaska.py”, line 111, in event_handler
return ha.post(‘alexa/smart_home’, event, wait=True)
File “/var/task/haaska.py”, line 63, in post
r = self.session.post(self.build_url(endpoint),
File “/var/task/requests/sessions.py”, line 581, in post
return self.request(‘POST’, url, data=data, json=json, **kwargs)
File “/var/task/requests/sessions.py”, line 533, in request
resp = self.send(prep, **send_kwargs)
File “/var/task/requests/sessions.py”, line 646, in send
r = adapter.send(request, **kwargs)
File “/var/task/requests/adapters.py”, line 516, in send
raise ConnectionError(e, request=request)END RequestId: abfa1fb0-887f-41e7-b664-cd9d165e08b0
REPORT RequestId: abfa1fb0-887f-41e7-b664-cd9d165e08b0 Duration: 73.05 ms Billed Duration: 74 ms Memory Size: 128 MB Max Memory Used: 50 MB Init Duration: 405.60 ms
Request ID
abfa1fb0-887f-41e7-b664-cd9d165e08b0