Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create lambda function that is an Alexa Skill backend #4131

Open
gamename opened this issue Feb 11, 2024 · 0 comments
Open

Cannot create lambda function that is an Alexa Skill backend #4131

gamename opened this issue Feb 11, 2024 · 0 comments

Comments

@gamename
Copy link

gamename commented Feb 11, 2024

Here is an example Alexa Skill lambda definition (below). I put it into a file called lambda.py and tried to create a new function on AWS:

from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.dispatch_components import AbstractRequestHandler
from ask_sdk_core.utils import is_request_type, is_intent_name

class LaunchRequestHandler(AbstractRequestHandler):
    """Handles LaunchRequest requests sent by Alexa"""
    def can_handle(self, handler_input):
        return is_request_type("LaunchRequest")(handler_input)

    def handle(self, handler_input):
        speech_text = "Welcome to the Alexa skill!"
        return handler_input.response_builder.speak(speech_text).ask(speech_text).response

class CustomIntentHandler(AbstractRequestHandler):
    """Handles CustomIntent intents"""
    def can_handle(self, handler_input):
        return is_intent_name("CustomIntent")(handler_input)

    def handle(self, handler_input):
        speech_text = "Handling your custom intent."
        return handler_input.response_builder.speak(speech_text).response

# Instantiate the SkillBuilder
sb = SkillBuilder()

# Add request handlers
sb.add_request_handler(LaunchRequestHandler())
sb.add_request_handler(CustomIntentHandler())

# Define the lambda handler
lambda_handler = sb.lambda_handler()

The creation fails (see below). There is a handler defined on the last line:

lambda_handler = sb.lambda_handler()

... but the tool doesn't recognize it:
image

Please update the tool to handle this case.

Thank you.


Toolkit: AWS Toolkit For JetBrains 2.5-233
OS: Mac OS X 14.2.1
IDE: PyCharm Professional Edition 233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant