2
votes

after setting up everything i am getting this error in while testing the skill in Alexa developer There was a problem with the requested skill's response then i put that json response in lambda test and i got the following

{ "errorType": "TypeError", "errorMessage": "Cannot convert undefined or null to object", "trace": [ "TypeError: Cannot convert undefined or null to object", " at Function.keys (<anonymous>)", " at Object.NewSession (/var/task/eventHandlers.js:28:20)", " at AlexaRequestEmitter.emit (events.js:198:13)", " at AlexaRequestEmitter.EventEmitter.emit (domain.js:448:20)", " at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:161:10)", " at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:124:23)", " at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:74:31)", " at Runtime.exports.handler (/var/task/index.js:20:11)", " at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)" ] }

Log output

The section below shows the logging calls in your code. These correspond to a single row within the CloudWatch log group corresponding to this Lambda function. Click here to view the CloudWatch log group.

START RequestId: f8127006-ae68-429b-b470-302b76bf3619 Version: $LATEST 2020-01-06T04:38:56.104Z f8127006-ae68-429b-b470-302b76bf3619 INFO Warning: Application ID is not set 2020-01-06T04:38:56.144Z f8127006-ae68-429b-b470-302b76bf3619 INFO {"eventType":"SessionStarted","event":{"userId":"amzn1.ask.account.AH5DAZ5QFPLU5NKA5XSU7PKCHUK4KCQTEUB3BBOSQ7COBQQ5EKW45X2445QZXZQJHO5HLXHIWSCPQ6TR2XYOZCPBG3GKDPQVWZK4WQN4OUWCNUW52WSLMZ2BBD4AANIR5SWIWQ5TJ6SSWN6KN5ZE73Q5UC6IBMONJ6MU6TRLLKFWUV3RKV7FE5P3SWODM23WJDXRVYBYDNZRRPY","sessionId":"amzn1.echo-api.session.92ab8d8e-8262-4f21-9f54-e556d78a8a6f","datestring":"2020-01-06T04:38:56.144Z"}} 2020-01-06T04:38:56.163Z f8127006-ae68-429b-b470-302b76bf3619 INFO Unexpected exception 'TypeError: Cannot convert undefined or null to object': TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at Object.NewSession (/var/task/eventHandlers.js:28:20) at AlexaRequestEmitter.emit (events.js:198:13) at AlexaRequestEmitter.EventEmitter.emit (domain.js:448:20) at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:161:10) at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:124:23) at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:74:31) at Runtime.exports.handler (/var/task/index.js:20:11) at Runtime.handleOnce (/var/runtime/Runtime.js:66:25) 2020-01-06T04:38:56.163Z f8127006-ae68-429b-b470-302b76bf3619 ERROR Invoke Error {"errorType":"TypeError","errorMessage":"Cannot convert undefined or null to object","stack":["TypeError: Cannot convert undefined or null to object"," at Function.keys (<anonymous>)"," at Object.NewSession (/var/task/eventHandlers.js:28:20)"," at AlexaRequestEmitter.emit (events.js:198:13)"," at AlexaRequestEmitter.EventEmitter.emit (domain.js:448:20)"," at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:161:10)"," at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:124:23)"," at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:74:31)"," at Runtime.exports.handler (/var/task/index.js:20:11)"," at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]} END RequestId: f8127006-ae68-429b-b470-302b76bf3619 REPORT RequestId: f8127006-ae68-429b-b470-302b76bf3619 Duration: 96.25 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 102 MB Init Duration: 567.43 ms

i have tried adding unhandled function but nothing happened i am unable to understand the issue please help!!

2
Can you add the JSON request you are sending to skill so that I debug the issue and try to elaborate more about the issue?sharan kenam

2 Answers

1
votes

The easiest way to debug this type of coding error is to use 'local debugging' so that you can step through your code in an IDE. This will be far more convenient that using plain stack traces in the ASK Response or by looking through CloudWatch logs.

Please see https://developer.amazon.com/blogs/alexa/post/77c8f0b9-e9ee-48a9-813f-86cf7bf86747/setup-your-local-environment-for-debugging-an-alexa-skill

1
votes

The npm package alexa-sdk is deprecated and no longer supported: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs (see top banner on this page for info).

It is recommended that you use ask-sdk or the ask-sdk-core going forward (ASK SDK V2).