question

xelfer avatar image
xelfer asked

There was a problem connecting to the LWA service

Hi there, I've got a headless device with the sample java client app running on it.

Usually, it will load after boot and just work, but more frequently lately I'm getting this error:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Alexa Voice Service Sample Java Client 20160207.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:exec (default-cli) @ sample-java-client ---
14:57:38.637 [Timer-0] ERROR com.amazon.alexa.avs.auth.companionapp.CompanionAppAuthManager - There was a problem connecting to the LWA service. Trying again in 2 seconds
14:57:38.652 [Timer-0] ERROR com.amazon.alexa.avs.auth.companionapp.CompanionAppAuthManager - There was a problem connecting to the LWA service. Trying again in 2 seconds
14:57:38.667 [Timer-0] ERROR com.amazon.alexa.avs.auth.companionapp.CompanionAppAuthManager - There was a problem connecting to the LWA service. Trying again in 2 seconds

This is my startup script:

cd /home/pi/Desktop/alexa-avs-raspberry-pi-master/samples/companionService && /usr/bin/npm start&

cd /home/pi/Desktop/alexa-avs-raspberry-pi-master/samples/javaclient && sleep 30 && /opt/apache-maven-3.3.9/bin/mvn exec:exec &

I added the sleep 30 to give the companion service plenty of time to start.

Can you offer any advice as to why this might happen and how I could fix it? I don't want to have to VNC into my device to restart the java client every time I restart the device.

Thanks!

alexa voice servicejava
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.

1 Answer

elstryan@Amazon avatar image
elstryan@Amazon answered

Hi Xelfer,

Can you check one thing for me: This appears like your config is setup for CompanionApp and NOT companionService. Can you check your provisioningMethod specified in your config.json and confirm that it is set to companionApp?

If that is indeed the case you don't need to start the companion service at all.

Can you try increasing the TOKEN_REFRESH_RETRY_COUNT and the TOKEN_REFRESH_RETRY_INTERVAL_IN_S in the CompanionAppAuthManager class?

2 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.

Hi elstryan,

Thanks for your response, I also figured out that yes I don't need to run the companion service (thanks!) though I'm still hitting the issue. I'll have a look at those token counts and let you know how I go.

0 Likes 0 ·

Well, that was fun. This code isn't respecting the refresh interval:

Thread.sleep(TOKEN_REFRESH_RETRY_INTERVAL_IN_S);

I've submitted a PR to fix it: https://github.com/amzn/alexa-avs-raspberry-pi/pull/253/files

After extending it to at least 30 seconds it appears to work now, I really shouldn't be starting my javaclient right on boot without network present. I'll fix how I'm doing that as well. Thank you!

0 Likes 0 ·