Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

AuthServer.py cannot connect to voice service #384

Closed
scurdy opened this issue Dec 11, 2017 · 16 comments
Closed

AuthServer.py cannot connect to voice service #384

scurdy opened this issue Dec 11, 2017 · 16 comments

Comments

@scurdy
Copy link

scurdy commented Dec 11, 2017

Alexa device SDK version 1.3 master
platform: macosx 10.13.2
hw: mac book pro Mid 2015, 2,5GHz intel Core i7

Sum up:
When trying to refresh token running python script AuthServer.py, python crashes with following trace:
Traceback (most recent call last):
File "AuthServer/AuthServer.py", line 194, in
app.run(host='127.0.0.1',port='3000')
File "/Users/gteudemo/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 841, in run
run_simple(host, port, self, **options)
File "/Users/gteudemo/Library/Python/2.7/lib/python/site-packages/werkzeug/serving.py", line 733, in run_simple
raise TypeError('port must be an integer')
TypeError: port must be an integer

expected result:
being able to refresh token

quick fix:
line 194

app.run(host='127.0.0.1',port='3000') ->app.run(host='127.0.0.1',port=3000)

Since AuthServer.py is auto-generated, it is a pity to have to modify it each time I make a clean build.

@scotthea-amazon
Copy link
Contributor

Hello scurdy,

Thank you very much for bringing this to our attention! I just tried to reproduce the problem you described and have not been able to. What version of Werkzeung are you running? You should be able to find it via:

pip freeze | grep Werkzeug

Thank you,
-SWH

@Scoobadood
Copy link

Plus one for this problem:
Python version 2.7.10 (default on OSX High Sierra clean install)
Werkzeug==0.13

@scurdy
Copy link
Author

scurdy commented Dec 12, 2017

yes the same here.
Werkzeug==0.13

@sanjayrd
Copy link
Contributor

Hi all,

Thank you for the information. We will investigate the issue and see if we can provide a fix soon.

Thanks,
Sanjay

@apowers313
Copy link

Duplicated here, same fix works.

@hivie7510
Copy link

I didn’t see the fix in the thread. I am having the same issue, could you clarify please?

@apowers313
Copy link

@hivie7510 Change this line:

app.run(host='127.0.0.1',port='3000')

to this (remove the quotes from around 3000):

app.run(host='127.0.0.1',port=3000)

@kclchan
Copy link
Contributor

kclchan commented Jan 2, 2018

Thanks to all! We will be incorporating this fix in our next software release.

@hivie7510
Copy link

I have gotten past the integer issue, but i am still not getting an open server to connect to at local host:3000

@kclchan
Copy link
Contributor

kclchan commented Jan 2, 2018

Hi @hivie7510, are you having problem with running "python AuthServer/AuthServer.py"? Or are you having problem connecting to http://localhost:3000 with your browser?

Also, please make sure you have entered the Allowed Origins and Allowed Return URLs as described here:
https://github.com/alexa/alexa-avs-sample-app/wiki/Create-Security-Profile

@hivie7510
Copy link

I checked the URLs for the return and they are correct. What I am not seeing is a message from the run statement that there is a server ready to receive requests. I did test my flask install by using a sample py file from flask and a server opens without issue. This is just the sample app from the links. I can post the whole config file if that helps.

@kclchan
Copy link
Contributor

kclchan commented Jan 3, 2018

Could you copy&paste the output after you run "python AuthServer/AuthServer.py"?

@hivie7510
Copy link

I get the standard error message when a 200 is not received, but I expected to see something saying that the server is running so I can hit the localhost:3000 url. Here is the output from the command line:

The refresh request failed with the response code 400. This might be due to a bad refresh token or bad client data. We will continue with getting a refresh token, discarding the one in the file.

That is on line 121 when the response from the post to the LWA url.

What I am not understanding is why the server won't start.

Here is the configs that I have:
{
"authDelegate":{
// The Client Secret of the Product from developer.amazon.com
"clientSecret":"REMOVED",
// Unique device serial number. e.g. 123456
"deviceSerialNumber":"123456",
// Refresh Token populated by running AuthServer.py
"refreshToken":"",
// The Client ID of the Product from developer.amazon.com
"clientId":"amzn1.application-oa2-client.{REMOVED}}",
// Product ID from developer.amazon.com
"productId":"Sample_App"
},
"alertsCapabilityAgent":{
"databaseFilePath":"/Users/ME/sdk-folder/application-necessities/alerts.db"
},
"settings":{
"databaseFilePath":"/Users/ME/sdk-folder/application-necessities/settings.db",
"defaultAVSClientSettings":{
"locale":"en-US"
}
},
"certifiedSender":{
"databaseFilePath":"/Users/ME/sdk-folder/application-necessities/certifiedSender.db"
}
}

@hivie7510
Copy link

if it helps, here is the post data that is sent:
client_secret=bd644e9mysecret&grant_type=refresh_token&client_id=amzn1.application-oa2-client.myclientid&refresh_token=rtest

@hivie7510
Copy link

Ok, I was able to make it work after a few changes.

I had to change the redirecturi to https:
redirectUri = 'https://127.0.0.1:3000/authresponse'

I also had to change the app run to use ad hoc ssl:
app.run(host='127.0.0.1',port=3000,ssl_context='adhoc')

@kclchan
Copy link
Contributor

kclchan commented Jan 3, 2018

Hi @hivie7510, I am happy to hear you finally got AuthServer.py to work for you.

But just curious, when I run Authserver.py, I also got this error message:
"The refresh request failed with the response code 400. This might be due to a bad refresh token or bad client data. We will continue with getting a refresh token, discarding the one in the file."

But I also see this message right after:
"* Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)"

And when I open a browser and navigate to http://localhost:3000, I see this:
"127.0.0.1 - - [03/Jan/2018 17:32:36] "GET / HTTP/1.1" 302 -"

So I am just wondering if you see the same?

celinval added a commit that referenced this issue Jan 13, 2018
Changes in this update:

**Enhancements**
* Added the Notifications Capability Agent. This allows a client to receive notification indicators from Alexa.
* Added support for the `SoftwareInfo` event. This code is triggered in the `SampleApp` by providing a positive decimal integer as the "firmwareVersion" value in "sampleApp" object of the `AlexaClientSDKConfig.json`. The reported firmware version can be updated after starting the `SampleApp` by calling `SoftwareInfoSender::setFirmwareVersion()`. This code path can be exercised in the `SampleApp` with the new command: `f`.
* Added unit tests for Alerts.
* The GStreamer-based pipeline allows for the configuration of `MediaPlayer` output based on information provided in `Config`.
* Playlist streaming now uses a `BLOCKING` writer, which improves streaming efficiency.

**Bug Fixes**
* Fixed bug where `SpeechSynthesizer` would not stop playback when a state change timeout was encountered.
* Fixed the `SampleApplication` destructor to avoid segfaults if the object is not constructed correctly.
* Fixed bug where `AudioPlayer` would erroneously call `executeStop()` in `cancelDirective()`.
* [Issue 396](#396) - Fixed bug for compilation error with GCC7 in `AVSCommon/SDKInterfaces/include/AVSCommon/SDKInterfaces/Audio/AlertsAudioFactoryInterface.h`
* [Issue 384](#384) - Fixed bug that caused `AuthServer.py` to crash.
* Fixed bug where a long delay was encountered after pausing and resuming a large Audible chapter.
* Fixed bug that caused named timers and reminders to loop for an additional `loopCount` .
* Fixed memory corruption bug in `MessageInterpreter`.
* Fixed illegal memory accesses in `MediaPlayer` logging.

**Known Issues**
* The `ACL` may encounter issues if audio attachments are received but not consumed.
* Display Cards for Kindle don't render.
* If using the GStreamer-based `MediaPlayer` implementation, after muting and un-muting an audio item, the next item in the queue will begin playing rather than continuing playback of the originally muted audio item.
* `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release.
* Music playback doesn't immediately stop when a user barges-in on iHeartRadio.
padillag pushed a commit to padillag/avs-device-sdk-intel-speech-enabling-kit that referenced this issue May 11, 2018
Changes in this update:

**Enhancements**
* Added the Notifications Capability Agent. This allows a client to receive notification indicators from Alexa.
* Added support for the `SoftwareInfo` event. This code is triggered in the `SampleApp` by providing a positive decimal integer as the "firmwareVersion" value in "sampleApp" object of the `AlexaClientSDKConfig.json`. The reported firmware version can be updated after starting the `SampleApp` by calling `SoftwareInfoSender::setFirmwareVersion()`. This code path can be exercised in the `SampleApp` with the new command: `f`.
* Added unit tests for Alerts.
* The GStreamer-based pipeline allows for the configuration of `MediaPlayer` output based on information provided in `Config`.
* Playlist streaming now uses a `BLOCKING` writer, which improves streaming efficiency.

**Bug Fixes**
* Fixed bug where `SpeechSynthesizer` would not stop playback when a state change timeout was encountered.
* Fixed the `SampleApplication` destructor to avoid segfaults if the object is not constructed correctly.
* Fixed bug where `AudioPlayer` would erroneously call `executeStop()` in `cancelDirective()`.
* [Issue 396](alexa/avs-device-sdk#396) - Fixed bug for compilation error with GCC7 in `AVSCommon/SDKInterfaces/include/AVSCommon/SDKInterfaces/Audio/AlertsAudioFactoryInterface.h`
* [Issue 384](alexa/avs-device-sdk#384) - Fixed bug that caused `AuthServer.py` to crash.
* Fixed bug where a long delay was encountered after pausing and resuming a large Audible chapter.
* Fixed bug that caused named timers and reminders to loop for an additional `loopCount` .
* Fixed memory corruption bug in `MessageInterpreter`.
* Fixed illegal memory accesses in `MediaPlayer` logging.

**Known Issues**
* The `ACL` may encounter issues if audio attachments are received but not consumed.
* Display Cards for Kindle don't render.
* If using the GStreamer-based `MediaPlayer` implementation, after muting and un-muting an audio item, the next item in the queue will begin playing rather than continuing playback of the originally muted audio item.
* `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release.
* Music playback doesn't immediately stop when a user barges-in on iHeartRadio.
padillag pushed a commit to padillag/avs-device-sdk-intel-speech-enabling-kit that referenced this issue May 11, 2018
Changes in this update:

**Enhancements**
* Added the Notifications Capability Agent. This allows a client to receive notification indicators from Alexa.
* Added support for the `SoftwareInfo` event. This code is triggered in the `SampleApp` by providing a positive decimal integer as the "firmwareVersion" value in "sampleApp" object of the `AlexaClientSDKConfig.json`. The reported firmware version can be updated after starting the `SampleApp` by calling `SoftwareInfoSender::setFirmwareVersion()`. This code path can be exercised in the `SampleApp` with the new command: `f`.
* Added unit tests for Alerts.
* The GStreamer-based pipeline allows for the configuration of `MediaPlayer` output based on information provided in `Config`.
* Playlist streaming now uses a `BLOCKING` writer, which improves streaming efficiency.

**Bug Fixes**
* Fixed bug where `SpeechSynthesizer` would not stop playback when a state change timeout was encountered.
* Fixed the `SampleApplication` destructor to avoid segfaults if the object is not constructed correctly.
* Fixed bug where `AudioPlayer` would erroneously call `executeStop()` in `cancelDirective()`.
* [Issue 396](alexa/avs-device-sdk#396) - Fixed bug for compilation error with GCC7 in `AVSCommon/SDKInterfaces/include/AVSCommon/SDKInterfaces/Audio/AlertsAudioFactoryInterface.h`
* [Issue 384](alexa/avs-device-sdk#384) - Fixed bug that caused `AuthServer.py` to crash.
* Fixed bug where a long delay was encountered after pausing and resuming a large Audible chapter.
* Fixed bug that caused named timers and reminders to loop for an additional `loopCount` .
* Fixed memory corruption bug in `MessageInterpreter`.
* Fixed illegal memory accesses in `MediaPlayer` logging.

**Known Issues**
* The `ACL` may encounter issues if audio attachments are received but not consumed.
* Display Cards for Kindle don't render.
* If using the GStreamer-based `MediaPlayer` implementation, after muting and un-muting an audio item, the next item in the queue will begin playing rather than continuing playback of the originally muted audio item.
* `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release.
* Music playback doesn't immediately stop when a user barges-in on iHeartRadio.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants