Alexa iPhone App, Firewall/NAT Open, MyMedia Media Error Invalid Request
Posted: Mon Nov 26, 2018 12:54 am
I'm experimenting with streaming My Media content to my iPhone via the Alexa app and seeing some weird behavior. I've opened up a port in my firewall for TCP port 52050 and created a NAT rule on the router which points from my public IP to the laptop running MyMedia on port 52050, and I've enabled "Enable via Firewall NAT" in the MyMedia GUI. When I ask the iPhone Alexa app to play something, like "Ask MyMedia to the song back in black" the app correctly comes back with "Playing the track Back In Black from you My Media collection". The My Media dashboard, however, reports the following error:
Alexa reported an error streaming the track Back In Black - MEDIA_ERROR_INVALID_REQUEST. If this happens on every track...
The error code was: MEDIA_ERROR_INVALID_REQUEST
The detailed message was: Invalid format.
And here are a few snippets from the log files (I've pruned just for example):
It happens on any track I test via the Alexa app on my iPhone and a track in any format (even if transcoding of non-MP3s is successful). All tracks play fine via the Echo on my home network, no issues. I'm wondering if in the above if the issue has to do with MediaItem and Client IDs being all zeros?
To further diagnose, when I manually attempt to connect to My Media remotely from a terminal with curl and nc then I can see successful connection attempts, see below for details, so it looks like both my firewall and NAT are working correctly.
When I look at the full logs I'm seeing that everything else looks good (including successful transcoding of non-MP3s to TranscodeCache). So I'm somewhat stuck on figuring out why My Media is throwing up the MEDIA_ERROR_INVALID_REQUEST error and not streaming through the Alexa app on my iPhone. Thoughts? Anything else I can test?
Thanks!
Alexa reported an error streaming the track Back In Black - MEDIA_ERROR_INVALID_REQUEST. If this happens on every track...
The error code was: MEDIA_ERROR_INVALID_REQUEST
The detailed message was: Invalid format.
And here are a few snippets from the log files (I've pruned just for example):
Code: Select all
12/11/2018 17:17:48.529 14157:0 81 ServiceAgent.cs:CreatePlaylist:2648 Exact match to input found, taking this result
12/11/2018 17:17:48.532 14157:0 21 PushClient.cs:Ws_OnMessage:283 Sending response: {"ResponseCode":200,"Playlist":{"ID":"7c1f8170-e4b8-4702-a0ae-8d3e5777ece1","MediaClientID":"abcdef1-1b4e-4a5b-8869-1ec75c25f7ce","Name":"the track Back In Black","Shuffle":false,"Loop":false,"Temporary":true,"CreateDate":"2018-11-12T
12/11/2018 17:17:49.087 14157:0 18 PushClient.cs:Ws_OnMessage:442 Preloading /AC_DC/Back In Black/03 Back In Black.mp3
12/11/2018 17:17:49.097 14157:0 146 ServiceAgent.cs:PreloadFile:2192 File opened successfully.
12/11/2018 17:17:55.993 14157:0 18 PushClient.cs:Ws_OnMessage:403 PlaylistItem request was for : PlaylistId:7c1f8170-e4b8-4702-a0ae-8d3e5777ece1, PreviousMedaiItemId:2a2beb1c-4013-471b-9585-f1b5565bf466, TrackRequest:NextTrack
12/11/2018 17:17:55.996 14157:0 18 ServiceAgent.cs:GetPlaylistMediaItem:2101 Next track - Got to the end of the playlist, looping is off and no more tracks, returning null
12/11/2018 17:17:55.999 14157:0 18 PushClient.cs:Ws_OnMessage:506 Sending response: {"ResponseCode":404,"PlaylistMediaItem":{"ID":"00000000-0000-0000-0000-000000000000","PlaylistID":"00000000-0000-0000-0000-000000000000","MediaItemID":"00000000-0000-0000-0000-000000000000","PlayOrder":0,"PlayOrderRandom":0,"Offset":0},"MediaItem":{"ID":"00000000-0000-0000-0000-000000000000","MediaClientID":"00000000-0000-0000-0000-000000000000","CheckSum":null,"FileName":null,"PlayCount":0,"Rating":0,"Title":null,"ContributingArtists":null,"AlbumArtist":null,"Album":null,"Year":0,"DiscNumber":0,"TrackNumber":0,"TrackCount":0,"Genre":null,"Composer":null,"Tag":null,"SourceID":null,"SourceName":null,"Indexed":"0001-01-01T00:00:00Z","Codec":"","Duration":0,"Hidden":false,"IsAudioBook":false,"GroupID":"00000000-0000-0000-0000-000000000000"},"SmallImage":null,"LargeImage":null,"MessageType":4,"Locale":"en-US","TransactionID":"abcdef1-8503-4735-9f8c-cad4486b1fd2"}
12/11/2018 17:17:56.334 14157:0 10 PushClient.cs:Ws_OnMessage:237 Received message: {"DeviceID":"amzn1.ask.device.AEAPX6Z6VZCJL.....<STRIPPED_STRING>","PlaylistID":"7c1f8170-e4b8-4702-a0ae-8d3e5777ece1","MediaItemID":"7e908afb-96aa-43c6-8ccf-8c443a528c2a","MediaPlaylistItemID":"2a2beb1c-4013-471b-9585-f1b5565bf466","Offset":0,"ErrorCode":"MEDIA_ERROR_INVALID_REQUEST","ErrorMessage":"Invalid format","NotifyType":4,"MessageType":9,"Locale":"en-US","TransactionID":"24304f11-f6aa-4a3a-bcb2-99f8e2c5b17f"}
12/11/2018 17:17:56.339 14157:0 10 MessageController.cs:AddMessage:114 Added 8a4f9d1c-bca3-4570-ad7a-941ad7c9bd37; Title:Alexa reported an error streaming the track Back In Black - MEDIA_ERROR_INVALID_REQUEST. If this happens on every track, please check your computer firewall settings or <a href='/index.html#!/faq'>review our FAQ</a>.; Description:Your Alexa device reported an error streaming the current track (/AC_DC/Back In Black/03 Back In Black.mp3).
To further diagnose, when I manually attempt to connect to My Media remotely from a terminal with curl and nc then I can see successful connection attempts, see below for details, so it looks like both my firewall and NAT are working correctly.
Code: Select all
---
$ curl -sI http://mymedia.server:52050/
HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Mono-HTTPAPI/1.0
Date: Mon, 12 Nov 2018 05:32:56 GMT
Content-Length: 0
Keep-Alive: timeout=15,max=100
---
---
$ nc mymedia.server 52050
HEAD
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Mon, 12 Nov 2018 05:33:28 GMT
Content-Length: 52
Connection: close
<h1>Bad Request (Invalid request line (parts).)</h1>
---
---
Output of MyMediaForAlexa.log during a successful curl request from outside
my network:
12/11/2018 17:34:35.785 14157:0 146 WebServer.cs:AuthenticationSchemeForClient:1086 Client authentication protocol selection in progress...http://mymedia.server:52050/
12/11/2018 17:34:35.786 14157:0 146 WebServer.cs:AuthenticationSchemeForClient:1091 Anonymous
12/11/2018 17:34:35.788 14157:0 07 WebServer.cs:AuthenticationSchemeForClient:1086 Client authentication protocol selection in progress...http://mymedia.server:52050/
12/11/2018 17:34:35.788 14157:0 07 WebServer.cs:AuthenticationSchemeForClient:1091 Anonymous
12/11/2018 17:34:35.789 14157:0 10 WebServer.cs:DoRequest:214 CurrentRequests Count = 2
12/11/2018 17:34:35.790 14157:0 10 WebServer.cs:DoRequest:238 WebRequest:1397 from 140.XXX.XXX.XXX, START WebServer::HTTP Request - HEAD url=http://mymedia.server:52050/ useragent=curl/7.54.0 headers=Host: mymedia.server:52050
User-Agent: curl/7.54.0
Accept: */*
12/11/2018 17:34:35.790 14157:0 10 WebServer.cs:DoRequest:249 WebRequest: invalid port web console request
12/11/2018 17:34:35.791 14157:0 10 WebServer.cs:DoRequest:982 WebRequest:1397 Closing stream.
12/11/2018 17:34:35.792 14157:0 10 WebServer.cs:DoRequest:1002 WebRequest:1397 Closed.
---
Thanks!