Fix Unauthorized Error on Alexa Test Simulator

0
3570
Fix Unauthorized Error on Alexa Test Simulator
Fix Unauthorized Error on Alexa Test Simulator

If you are facing the unauthorized error on Alexa Test Simulator when testing your Alexa Skills during development, this is how to fix it.

Today, I was curious about Alexa Skill development since I’ve just got a new Echo Dot (3rd gen) for personally, certainly. It is pretty interesting.

So I dig through the official tutorials on Amazon Alexa Skill Kit Development, it is Create a Skill in 5 Minutes.

Alexa Test Simulator Error

And then, when I was about to test the skill via Test menu, which is to access Alexa Test Simulator on the cloud, I typed in the invocation or speak through microphone, it didn’t work. So I opened Chrome Dev Console to see what happened.

Here the log I got.

OPTIONS https://avs-alexa-na.amazon.com/v20160207/events 401 (Unauthorized)

Access to fetch at 'https://avs-alexa-na.amazon.com/v20160207/events' from origin 'https://developer.amazon.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Uncaught (in promise) TypeError: Failed to fetch

At first, I thought it was because of security in Chrome that prevents invalid CORS requests. So I tried to start Chrome with --disable-web-security but it was still the same.

Then I searched through whole Amazon Developer Forum, but couldn’t find the answer.

After several hours, it just popped out of my head that it might be blocked by Antivirus, since I have Avast Security on my Mac. So I looked up all the options, and I disabled this one on Web Shield.

Uncheck secure scan on Web Shield in Avast Security
Uncheck secure scan on Web Shield in Avast Security

Then, I tried again with Alexa Test Simulator, it works out of the box now.

So it looks like that antivirus does have some functions to scan and block some requests that might look suspicious on browsers.

I also asked this question on Amazon Developer Forum, and provided an answer, you can refer to it.

In conclusion

If you’re facing similar issues like I had above, then you can try to disable secure scan on your antivirus, if you have them installed on your computer. Or, you can try some solutions I tried above also. It might help you get it work.