question

newuser-64a41272-f9be-4eda-8d84-71a5b807515c avatar image
newuser-64a41272-f9be-4eda-8d84-71a5b807515c asked ·

Cannot read property 'type' of undefined error coming in log

Hi there,

I am creating my first custom alexa skill.Kindly help me in the same.I have been getting this error every time. The intent response is generated but i am getting this error in logs.I really need help.KIndly help me to debug.

alexa skills kitlambdaintentsawslaunch
1 comment
10 |2000 characters needed characters left characters exceeded

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

Share some code that does it. It seems that you are trying to read property 'type' which doesn't exist. Without seeing the code it is impossible to help you.

-2 Likes -2 ·
newuser-64a41272-f9be-4eda-8d84-71a5b807515c avatar image
newuser-64a41272-f9be-4eda-8d84-71a5b807515c answered ·

hi there,

{ "errorMessage": "Cannot read property 'type' of undefined", "errorType": "TypeError", "stackTrace": [ "Object.canHandle (/var/task/index.js:6:53)", "GenericRequestMapper.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:69:61)", "step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:44:23)", "Object.next (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:25:53)", "/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:19:71", "new Promise (<anonymous>)", "__awaiter (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:15:12)", "GenericRequestMapper.getRequestHandlerChain (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:58:16)", "GenericRequestDispatcher.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:133:60)", "step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:44:23)" ] }

i am always getting this error although the response is coming sometimes.also i ma getting audio response sometimes.

snap8.png

snap9.png


snap8.png (18.7 KiB)
snap9.png (8.3 KiB)
10 |2000 characters needed characters left characters exceeded

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

newuser-64a41272-f9be-4eda-8d84-71a5b807515c avatar image
newuser-64a41272-f9be-4eda-8d84-71a5b807515c answered ·

{ "errorMessage": "Cannot read property 'type' of undefined", "errorType": "TypeError", "stackTrace": [ "Object.canHandle (/var/task/index.js:6:53)", "GenericRequestMapper.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:69:61)", "step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:44:23)", "Object.next (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:25:53)", "/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:19:71", "new Promise (<anonymous>)", "__awaiter (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:15:12)", "GenericRequestMapper.getRequestHandlerChain (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:58:16)", "GenericRequestDispatcher.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:133:60)", "step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:44:23)" ] }

i am always getting this error though the response is coming.

snap8.pngsnap9.png


snap8.png (18.7 KiB)
snap9.png (8.3 KiB)
10 |2000 characters needed characters left characters exceeded

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

newuser-64a41272-f9be-4eda-8d84-71a5b807515c avatar image
newuser-64a41272-f9be-4eda-8d84-71a5b807515c answered ·

Hi there,

{ "errorMessage": "Cannot read property 'type' of undefined", "errorType": "TypeError", "stackTrace": [ "Object.canHandle (/var/task/index.js:6:53)", "GenericRequestMapper.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:69:61)", "step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:44:23)", "Object.next (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:25:53)", "/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:19:71", "new Promise (<anonymous>)", "__awaiter (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:15:12)", "GenericRequestMapper.getRequestHandlerChain (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/request/mapper/GenericRequestMapper.js:58:16)", "GenericRequestDispatcher.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:133:60)", "step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:44:23)" ] }

I am always getting this error in response although my response is coming.Kindly help with this i am attaching the snaps.

snap8.pngs

nap9.png


snap8.png (18.7 KiB)
snap9.png (8.3 KiB)
3 comments
10 |2000 characters needed characters left characters exceeded

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

Can you also post the request that is throwing this error?

0 Likes 0 ·

Sure..Its actually coming with every handler

snap8.png

0 Likes 0 ·
snap8.png (18.7 KiB)
Rokas avatar image Rokas newuser-64a41272-f9be-4eda-8d84-71a5b807515c ·
I meant request from the console, the json that is displayed here when you invoke the skill:

0 Likes 0 ·
milanc avatar image
milanc answered ·

Remove the ";" character in the "return;" statements. It stop the code evaluation too early so your CheckHandler.handle function does not return a response.

1 comment
10 |2000 characters needed characters left characters exceeded

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

snap10.png

Even i removed the error.It gives audio only response.What should i do.And the typeerror is not solved

0 Likes 0 ·
snap10.png (28.5 KiB)
Oliver@Amazon avatar image
Oliver@Amazon answered ·

Hey there, in your snap9.png, you are doing this

handlerInput.requestEnvelope.request.type == 'Check'

You mentioned in another forum thread by you that 'Check' is the name of the intent.

Instead you should be checking for intent name as below! Check out a sample that shows this.

handlerInput.requestEnvelope.request.intent.name == 'Check'
10 |2000 characters needed characters left characters exceeded

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