question

Jakub avatar image
Jakub asked

Reminders API Error

Hello! I am pretty new in developing Alexa Skills. I'm creating an app, where you can check the time of your next bus on your nearest bus stop. When bus is near this bus stop, you get the reminder on your Echo and Alexa App. Everything works well on my account, on wich I created this app. The problem occured when I gave my Beta Skill to test it by someone else. When I use this app from my account everything works as it should, but when someone else tries to do it, there is an error. Permissions for this skill are already set up. I was debugging my skill for hours, trying to check on witch line this error exists. It happens to be here "reminderApiClient.createReminder(reminderRequest);"
What I do is:
  1. const reminderRequest = { trigger: { type: "SCHEDULED_RELATIVE", offsetInSeconds: "15", }, alertInfo: { spokenInfo: { content: [ { locale: "en-GB", text: "The Reminder", }, ], }, }, pushNotification: { status: "ENABLED", }, };
  2. let reminderApiClient = handlerInput.serviceClientFactory.getReminderManagementServiceClient();
  3. await reminderApiClient.createReminder(reminderRequest);
  4. exports.handler = Alexa.SkillBuilders.custom() .addRequestHandlers( ... ) .addErrorHandlers(ErrorHandler) .withPersistenceAdapter( new Adapter.DynamoDbPersistenceAdapter({ tableName: dynamoDBTableName, }) ) .withApiClient(new Alexa.DefaultApiClient()) .lambda();
So As I said, weird thing is that on my primary account the skill is working correctly, but on the second account (where is beta test), reminder is giving me an error. Any thoughts?
skillapireminders
10 |5000 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.

Andy Whitworth avatar image
Andy Whitworth answered

Hi Jakub,

A couple of questions for you:

1. What is the error message you get ? If you don't know, add a try {} catch block around step 3 and output the error to console.log in the catch() block.

2. Has the beta user enabled permissions to get reminders ? By default permissions will be disabled, they need to go into the Alexa app and enable them. Your skill code should handle the case when a user of the skill has not enabled reminder permissions and send a permissions card if so (you can also ask for permissions via voice I believe).

See this example skill for details of how to detect if permissions have been given and how to send a card asking for permissions

https://github.com/alexa/alexa-cookbook/blob/feature-demos/feature-demos/skill-demo-reminders/lambda/custom/index.js

Specifically the CreateReminderHandler

10 |5000 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.

Jakub avatar image
Jakub answered

Thanks for answer Andy!

To make it more simple, I deployed skill you sent in the link above.

Exactly the same problem occured. In the console the log is: ERROR MESSAGE: Unknown error

Alexa is saying message "There was an error with the Reminders API".

So on my account it works perfectly fine, but second account have this error message, even if Reminder Permission is granted.

7 comments
10 |5000 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 add this debug statement to your handler which is calling the Reminder API (before the API call)

console.log ( JSON.stringify ( requestEnvelope.context.System ));

And post up the output from Cloudwatch.

0 Likes 0 ·
Jakub avatar image Jakub Andy Whitworth ·
Alright. I tried to paste this code, but it's too long.


So on the account where program (and especially reminder) is working correctly (using echo dot), log looks like this:


0 Likes 0 ·

I could see it just fine. You've now deleted it! Paste up the output for the user where you get the error.

0 Likes 0 ·
Jakub avatar image Jakub Andy Whitworth ·

Unfortunately this log is way to long to show here. If you give me your email, i will show you the difference on my account where program is working, and in second account, where reminders are not working correctly.


I did like you said. I logged this line just before creating reminder:

console.log("System:",JSON.stringify(handlerInput.requestEnvelope.context.System));
await reminderApiClient.createReminder(reminderRequestHelper);



But comparing two logs (from first account where reminders are working and second one where they don't) here is the difference:

applicationId: remains the same in both files
userId: different in both files (as they should)

consentToken: different in both files. I don't know if that's good or bad for reminders.

deviceId: different, as they should

apiEndpoint: same in both files ("https://api.eu.amazonalexa.com")

apiAccessToken different in both files. I don't know if that's good or bad

unitId: different. Not sure if that's good or bad.



Is that helpful?

0 Likes 0 ·
Yes, that's helpful. I wanted to ensure you got a consent token for both the working and non-working cases. They will be different, that's fine.

So everything looks fine, how are you testing the two cases ? Using a real Alexa device ? One for each case ? Registered to different Amazon accounts ?

Give me as much info as you can.

0 Likes 0 ·
Show more comments