keatontaylor / alexa-actions

A README and associated code to get actionable notifications setup for Alexa devices.
GNU General Public License v3.0
391 stars 186 forks source link

[Bug]: Chapter: "Alexa Talking to Home Assistant (The Skill)" - No module named 'ask_sdk_core' #244

Closed eherranzr closed 4 months ago

eherranzr commented 5 months ago

Did you check our FAQ and Issue/PR for similar issues?

Contact Details

emiliojrherranz@hotmail.com

What happened?

I followed several times the wiki page, both using WithBinary and NoBinary files but always get an error with the anwer of the skill even at the end of the process.

Locale is ES-es in case it's important.

CloudWatch complains about No module named 'ask_sdk_core'.

Version

v0.12.2

What Alexa device are you using?

Echo

What other Alexa device are you using?

No response

Relevant log output

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   timestamp   |                                                                                                                                                                                                                                                                                                                                         message                                                                                                                                                                                                                                                                                                                                         |
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1710692630288 | INIT_START Runtime Version: python:3.8.v44 Runtime Version ARN: arn:aws:lambda:eu-west-1::runtime:4081a148a414cdf15d7ada61c811c65f179819f7c8fd2d2e168e541ebe0d2af8                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 1710692630472 | START RequestId: 9144f495-cc8a-4396-af04-58164d280f90 Version: 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 1710692630473 | LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html  |
| 1710692630473 | [ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'ask_sdk_core' Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 1710692630476 | END RequestId: 9144f495-cc8a-4396-af04-58164d280f90                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 1710692630476 | REPORT RequestId: 9144f495-cc8a-4396-af04-58164d280f90 Duration: 4.28 ms Billed Duration: 5 ms Memory Size: 512 MB Max Memory Used: 43 MB Init Duration: 182.84 ms                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 1710692630838 | START RequestId: 84e49c43-033a-404d-9f97-1e388be3731d Version: 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 1710692630839 | LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html  |
| 1710692630839 | [ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'ask_sdk_core' Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 1710692630840 | END RequestId: 84e49c43-033a-404d-9f97-1e388be3731d                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 1710692630840 | REPORT RequestId: 84e49c43-033a-404d-9f97-1e388be3731d Duration: 1.78 ms Billed Duration: 2 ms Memory Size: 512 MB Max Memory Used: 43 MB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
cobbtm2003 commented 5 months ago

I am seeing the same thing after going through the instructions in the wiki. I also tried over and over before noticing that this issue was posted. I also tried both binary and non binary. I used en-US and Virginia locations/languages.

danielbrunt57 commented 5 months ago

@DEADSEC-SECURITY Antonio, I stepped through page 3 of the wiki very carefully again while creating a new "Test" skill. I fixed a couple of minor typos and slightly adjusted the sequencing of text near the end but I ended up with the same result as @eherranzr: the alexa developer console appears to now require the lambda code to include ask_sdk_core (and perhaps also ask_sdk_model and ask_sdk_runtime).

My previously deployed Actionable Notications skill (Last successful build: 3/18/2024@1:19 AM) is working fine and I followed the same steps. Amazon seems to have changed something yet again within the last week...

danielbrunt57 commented 5 months ago

After several hours, I now have a working version (again). Here is the link to import the custom skill from my forked version: https://github.com/danielbrunt57/alexa-actions.git

I've included the 4 files/folders which previously had to be added from the master version's ZIP file so that step is not required.

My mods include the requirements.txt file:

ask_sdk_core
isodate~=0.6.0
pydantic~=1.10.4
typing-extensions~=4.10.0
urllib3==1.26.1

And also the lambda_function.py file:

""" NO NEED TO EDIT ANYTHING UNDER THE LINE """
# Built-In Imports
import ask_sdk_core
import ask_sdk_model
import json
import urllib3
from ask_sdk_core.dispatch_components import AbstractExceptionHandler
from ask_sdk_core.dispatch_components import AbstractRequestHandler
from ask_sdk_core.dispatch_components import AbstractRequestInterceptor
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.utils import (
    get_account_linking_access_token,
    is_request_type,
    is_intent_name,
    get_intent_name,
    get_slot,
    get_slot_value,
)
from ask_sdk_model import SessionEndedReason
from ask_sdk_model.slu.entityresolution import StatusCode
from typing import Union, Optional
from urllib3 import HTTPResponse

# Local Imports
import isodate
import prompts
from schemas import HaState, HaStateError
from utils import get_logger
from const import (
    INPUT_TEXT_ENTITY,
    RESPONSE_YES,
    RESPONSE_NO,
    RESPONSE_NONE,
    RESPONSE_SELECT,
    RESPONSE_NUMERIC,
    RESPONSE_DURATION,
    RESPONSE_STRING,
    RESPONSE_DATE_TIME,
)
eherranzr commented 5 months ago

Hi Daniel,

With your forked version I have been able to build a working version of the skill. In fact, the ease of not uploading any zip file also helps to speed up the process.

Thanks

danielbrunt57 commented 5 months ago

Yes, and I have done it so many times now I can do it in less than 3 minutes, maybe even blindfolded!

danielbrunt57 commented 5 months ago

@cobbtm2003 Have you tried it yet?

legolas0802 commented 5 months ago

After several hours, I now have a working version (again). Here is the link to import the custom skill from my forked version: https://github.com/danielbrunt57/alexa-actions.git

I've included the 4 files/folders which previously had to be added from the master version's ZIP file so that step is not required.

  • typing_extensions.py
  • pycache/
  • isodate/
  • pydantic/

My mods include the requirements.txt file:

ask_sdk_core
isodate~=0.6.0
pydantic~=1.10.4
typing-extensions~=4.10.0
urllib3==1.26.1

And also the lambda_function.py file:

""" NO NEED TO EDIT ANYTHING UNDER THE LINE """
# Built-In Imports
import ask_sdk_core
import ask_sdk_model
import json
import urllib3
from ask_sdk_core.dispatch_components import AbstractExceptionHandler
from ask_sdk_core.dispatch_components import AbstractRequestHandler
from ask_sdk_core.dispatch_components import AbstractRequestInterceptor
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.utils import (
    get_account_linking_access_token,
    is_request_type,
    is_intent_name,
    get_intent_name,
    get_slot,
    get_slot_value,
)
from ask_sdk_model import SessionEndedReason
from ask_sdk_model.slu.entityresolution import StatusCode
from typing import Union, Optional
from urllib3 import HTTPResponse

# Local Imports
import isodate
import prompts
from schemas import HaState, HaStateError
from utils import get_logger
from const import (
    INPUT_TEXT_ENTITY,
    RESPONSE_YES,
    RESPONSE_NO,
    RESPONSE_NONE,
    RESPONSE_SELECT,
    RESPONSE_NUMERIC,
    RESPONSE_DURATION,
    RESPONSE_STRING,
    RESPONSE_DATE_TIME,
)

it works perfectly, thanks

cobbtm2003 commented 5 months ago

@cobbtm2003 Have you tried it yet?

Yes, and it is in fact working now. Thank you Thank you!

timROfu commented 5 months ago

Absolute legend @danielbrunt57 - been bashing away at this all day - and being a total Noob forgot to check the issues up front. Thankyou @danielbrunt57 and Thanks @DEADSEC-SECURITY for this Skill in the first place.

DEADSEC-SECURITY commented 4 months ago

Dude I'm so mad at AWS cuz they keep on changing stuff and its breaking everything. I'm sorry guys. I'm trying to get back into helping out with people here in issues.

DEADSEC-SECURITY commented 4 months ago

Guys, please use the zip files provided by the release files. I cannot have package files in the repo for multitude of reasons. Please let me know if there is an issue with the zip files in release so I can look into it