newuser-8aeb3f79-e874-4321-b35b-1323020dbfa9 avatar image

Alexa skill error: 'NoneType' object has no attribute 'object_type'

I have been developing a timer request template for the last 3 weeks and have finally come down to this code. The function is almost working as the voice permission works. However, I am getting stop by this error that I don't understand nor now how to fix. Would love your input so we can launch the template to the community :)

timer = {
    "duration": "PT15S",
    "timerLabel": "Change name",
    "creationBehavior": {
        "displayExperience": {
            "visibility": "VISIBLE"
    "triggeringBehavior": {
        "operation": {
            "type": "ANNOUNCE", 
            "textToAnnounce": [
                    "locale": "en-US",
                    "text": "Break time"
        "notificationConfig": {
            "playAudible": True 

class LaunchRequestHandler(AbstractRequestHandler):
    def can_handle(self, handler_input):
        return ask_utils.is_request_type("LaunchRequest")(handler_input),ask_utils.is_request_type("AMAZON.YesIntent")(handler_input), ask_utils.is_request_type("AMAZON.NoIntent")(handler_input)
    def handle(self, handler_input):
        accessToken= ask_sdk_core.utils.get_api_access_token
        rb = handler_input.response_builder
        request_envelope = handler_input.request_envelope
        permissions = request_envelope.context.system.user.permissions
        if not (permissions and permissions.consent_token):
  "user hasn't granted reminder permissions")
            return (
                                "@type": "AskForPermissionsConsentRequest",
                                "@version": "1",
                                "permissionScope": "alexa::alerts:timers:skill:readwrite",
            speak_output = "would you like to set the timer for 20 minutes?"
            if ask_utils.is_request_type("AMAZON.YesIntent")(handler_input): 
                options = {"Authorization": "Bearer " + accessToken,
                            "Content-Type": "application/json"}
      "", timer, options)
                speak_output = "timer set for 20 seconds"

Error: Alexa skill error: 'NoneType' object has no attribute 'object_type' Please let me know if there are any other possible bug causing line that haven't caught my eyes yet.

Stay safe & happy coding.

alexa skills kitapipythonrequesttimers-ao
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Amazon_Bernardo Bezerra avatar image
Amazon_Bernardo Bezerra answered

Hello and thank you for posting.

If I understood your code correctly, you are testing if the user has provided permissions to the skill and if yes, you proceed to ask them if they would like to set a timer for 20 minutes.

However, this question is never passed to the user. Instead, your handler is testing the handler_input for the request type. Since this is all happening in the LaunchRequest handler, this will always return False.

You need to first return the response with the "would you like to se the timer for 20 minutes" question and then code and register a new handler for the AMAZON.YesIntent.


10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.