Amazon Alexa Debugging - node.js

I am working on Skill related to audio with Nodejs, but once I made some changes I found it's difficult to debug here.
I added several console.log and also tried by adding debugger but I didn't understand where to check those console.log ?
Can anyone tell me an easy way to debugging Alexa skill (I already checked console.awe.amazon but seems unrelated everything)

In case of having an Alexa hosted skill. Go to the code section. In your lower left the logs link is shown.
Only if you hosted your skill using lambda, which therefore means you have an aws account, you have the cloudwatch linking which lambdas have by default.

An important step in Alexa Skill Development is to examine the logs by enabling the CloudWatch for your skill. It logs out the sequence of events as well as console.log() that one has put in the code.
You have to provide CloudWatch access permission for the role that you supplied when setting up the Lambda Function for your Alexa Skill.
Further, if you want to debug the execution locally, you can make use of this extremely useful tool, Bespoken

Related

Google Cloud Speech-to-Text non-intrusive end-user authentication

I am working on a desktop application using GCP Speech-to-Text API to perform streaming recognition. I'm using Python 3 and Google client libraries, google.cloud.speech. I've started off the transcribe streaming infnite Python sample and built around those concepts, and everything works nicely. I'm now trying to get to the end user access question, as I'm currently using a service account file for development purposes, which I'm obviously not willing to distribute to all users.
Basically, how do I give access to my end users to the Speech-to-Text service for streaming recognition in the least intrusive way possible? I have no need for accessing storage or the like, as I don't access buckets contents and stream all audio directly. I actually don't need any user information, I only need GCP to process the STT requests and send me the responses.
I see 2 solutions that should work on paper, out of the three the documentation mentions (I leave out the service account file ones):
API key
OAuth2
API key
API keys sound like my dream option: it's simple, doesn't require user interaction past initial setup, I can manage such keys in GCP's console, and it should be able to grant access to what I need (as I effectively don't need any user info, an account is mostly irrelevant).
However, how to use an API key using the Google Speech client library totally eludes me. I can see a PUB/SUB Go example, but I can't find any mapping to Python. I'm not even 100% sure it can work, as the Go documentation for the option seems to note it only works for JSON-over-HTTP, and I believe the client library for Speech-to-Text is using gRPC.
Yet, at least with a JSON non-streaming recognize request, I can use such an API key, and successfully did so manually using cURL on the command-line. So I still have a little bit of hope, in case the gRPC restriction either isn't true or doesn't concern my use case.
This part's question would summarize as: "how do I specify an API key using the Python SpeechClient?".
OAuth2
This sounds like my second-best option, as it uselessly asks the user for authentication while I don't actually need any personal data. Yet, I still have serious issues I'm struggling to overcome:
How do I reliably store info that prevent me from having to re-ask the user for authorization every single time the app runs? google_auth_oauthlib's InstalledAppFlow doesn't seem to provide such feature, so I'm rolling my own based on google.oauth2.credentials.Credentials.from_authorized_user_file() after having saved them with the to_json() the first time I obtained them with InstalledAppFlow. I'm however confident this will not last, and I'm really not sure how to check whether the credentials are still good before I fail to use an API with them (e.g. I can't seem to be able to rely on Credentials.valid before they actually get used).
There seem to be no specific Speech-to-Text scopes, and the required one is way broader than what I need, leading to an overly complex and frightening authorization request. And no, without this scope I cannot access the Speech-to-Text API, I tried :)
Summary
To summarize: what is my best and least-intrusive option to provide credentials to be able to use GCP Speech-to-Text in my desktop application?

Alexa skill dies/crashes/quits occasionally with no error

I'm developing an Alexa Skill hosted on an AWS Lambda.
Everything works fine with the skill most of the time, and there are no problems running it on the Alexa Developer Skill simulator page.
However, when running on an Echo Dot device, sometimes while processing a user response, the skill will just die/quit/crash for no reason, and no error is thrown at all.
Sorry I can't be more specific than this, I just wondered whether anyone else had encountered a similar issue, and whether there are any common "gotchas" I should be aware of.
Cheers.
I would check cloudwatch, and maybe increase the lamda timeout / memory. The other thing to consider is your internet connection, firewall etc. I had experience something similar when my device is connected to a specific firewalled configuration.

I want to use Alexa API to read grocery list (for display in a web app.) Must I write a "skill"?

First my apologies if this is a dumb question, or has been asked before. I've been searching for a couple of days and can't find an answer. This usually means I'm asking a dumb question. ;-)
I have a rPi and touchscreen in my kitchen; it displays helpful things like appointments for next 7 days, weather next 7 days, news headlines, etc. It's a web app I wrote in Angular 7, and it queries a NodeJS v8 backend which I also wrote. This was a hobby project to learn Angular and Node.
The Node app performs all interactions with the outside world, using Google's Calendar API to get appointments, Yahoo Weather API, newsapi.org. All of these integrations followed the same pattern -- obtain some apikey token, and use that when invoking some API method to get the requested data in a JSON wad.
Now, I would like to also get the grocery list from my Echo. After reviewing Amazon's Alexa API documentation, it doesn't appear that I can do this the same way as the previous three integrations I did. Must I really write a "skill" for this, though I never intend to invoke it on the Echo?
And if so, could you point to a decent sample? None of the samples provided by Amazon utilize the Lists API.
Yes, you must create a skill in order to receive access_token. And then - Out of Session Interaction feature might be useful.

Alexa skill will not install via voice

I have an Alexa skill that's been published and in the alexa app store for some time. Recently, the ability for users to install this skill by voice no longer works. I noticed this within the last 7 days.
Now when a user asks 'Alexa, enable shop clerk', they hear the message:
"If you'd like to enable this skill, you can do so by finding it in the Skills section of your Alexa app."
Previously (and for virtually all skills I've tried) the normal response is to install and enable the skill.
Has anyone seen this behavior or have an idea of how I can resolve this issue?
I received the following info from the Amazon Alexa team:
Thanks for your patience. To ensure the high-quality and accuracy of the voice-enablement feature for skills, we are making improvements to the feature. During this time, the feature will not apply to all skills.
Basically, they're saying "yeah, it doesn't work for your skill anymore."
I followed up with them and they acknowledge that it is a challenge for us but that they can give no information as to why this happened to us, how we can resolve it, or when (or even if) it will ever be resolved.

Any decent NPMs to get AWS Cognito Authentication working with Node.js/Express?

Might just be that I'm getting documentation fatigue (going through the rabbit hole that is the AWS docs)...but I'm not finding any turnkey NPM/examples to Authenticate Users against AWS Cognito, in Node.js/Express. I've seen quite a few examples but all either bomb out, are incomplete/vague or require duct tape and bubble gum (pollyfill, web packs, switching to React) or suggest handling all in client (rather than Node backend/routing).
I've also tried using the Cognito Application UI for login, but haven't yet seen how to parse the tokens, etc in order to validate session from screen to screen.
NOTE: i'm still early in my diving into Cognito...but wondering if anyone has come across (or built) any NPMs that might make this less of a headache.
thx.

Resources