googlearchive / drive-music-player

Fully client side Music Player for Google Drive
http://www.driveplayer.com
Apache License 2.0
574 stars 211 forks source link

Possible Scalability Issue: You are not authorized to read this file or the file does not exist #84

Open justinbass opened 9 years ago

justinbass commented 9 years ago

I have created a playlist for my main collection, 700 songs. When I open this playlist (or all of the songs from the 'My Drive' tab), DMP displays the titular error message ('You are not authorized to read this file or the file does not exist') for a seemingly arbitrary set of songs, about 1/4 of the entire playlist and not related by name, size, date, or length, filetype, or metadata. It is always the same arbitrary songs, even when opening and closing the app.

screen shot 2015-10-06 at 10 47 14 am

When I refresh and choose any of the individual broken songs to select from 'My Drive', it plays them and then they are permanently available from the playlist. In fact, I seem to be able to do this for at least 100 songs at a time, permanently removing the error from any songs in that selection that might have had it before. I haven't determined at what point this workaround stops working, but selecting the 700 songs from 'My Drive' definitely does not fix the error, and the same songs with errors in the playlist have errors in this 700-song selection too (as mentioned above).

I did a bit of digging and debugging - I setup your app locally with Python's SimpleHTTPServer and the same songs have the error message as at driveplayer.com, so I thought it could be a problem with Google Drive's API. I noticed there is a limit of 10 API requests per second, so I implemented a random setInterval on one of the functions that makes the API call, slowing the requests down to 1 per second and taking ~10 minutes total to load (my forked code is, ironically, not in Google Drive or Github - when I get access I can give more info on which function I delayed). Still, the error appeared for those songs. Plus, it's the same songs every time and it is fixed through my hacky-workaround, so this idea was shaky to begin with.

I tried setting permissions in Google Drive (global settings, application security settings, individual file sharing settings) but nothing I tried worked.

I'm out of ideas. Any insight on this?

justinbass commented 9 years ago

Here is some expanded log information (apologies for the giant blocks). I ran everything in Chrome version 43. No difference between local SimpleHTTPServer and driveplayer.com.

The Chrome console log when trying to play the 'You are not authorized...' song:

GET https://content.googleapis.com/drive/v2/files/0BwJXpSIJJBiyQkZGa0RLcTFmUkk 404 (OK)zu @ cb=gapi.loaded_0:99n @ cb=gapi.loaded_0:99Cu @ cb=gapi.loaded_0:99(anonymous function) @ cb=gapi.loaded_0:100g @ cb=gapi.loaded_0:56c @ cb=gapi.loaded_0:47 dmp.drive.js:105 Error while fetching the file's metadata: File not found: 0BwJXpSIJJBiyQkZGa0RLcTFmUkk cb=gapi.loaded_0:99 GET https://content.googleapis.com/drive/v2/files/0BwJXpSIJJBiyQkZGa0RLcTFmUkk 404 (OK)zu @ cb=gapi.loaded_0:99n @ cb=gapi.loaded_0:99Cu @ cb=gapi.loaded_0:99(anonymous function) @ cb=gapi.loaded_0:100g @ cb=gapi.loaded_0:56c @ cb=gapi.loaded_0:47 dmp.drive.js:105 Error while fetching the file's metadata: File not found: 0BwJXpSIJJBiyQkZGa0RLcTFmUkk cb=gapi.loaded_0:99 GET https://content.googleapis.com/drive/v2/files/0BwJXpSIJJBiyQkZGa0RLcTFmUkk 404 (OK)zu @ cb=gapi.loaded_0:99n @ cb=gapi.loaded_0:99Cu @ cb=gapi.loaded_0:99(anonymous function) @ cb=gapi.loaded_0:100g @ cb=gapi.loaded_0:56c @ cb=gapi.loaded_0:47 dmp.drive.js:105 Error while fetching the file's metadata: File not found: 0BwJXpSIJJBiyQkZGa0RLcTFmUkk dmp.player.js:125 Next song index is: 670 dmp.player.js:143 Now playing song: [object Object] cb=gapi.loaded_0:99 GET https://content.googleapis.com/drive/v2/files/0BwJXpSIJJBiyQkZGa0RLcTFmUkk 404 (OK)zu @ cb=gapi.loaded_0:99n @ cb=gapi.loaded_0:99Cu @ cb=gapi.loaded_0:99(anonymous function) @ cb=gapi.loaded_0:100g @ cb=gapi.loaded_0:56c @ cb=gapi.loaded_0:47 dmp.drive.js:105 Error while fetching the file's metadata: File not found: 0BwJXpSIJJBiyQkZGa0RLcTFmUkk dmp.player.js:125 Next song index is: 671 dmp.player.js:143 Now playing song: [object Object] dmp.drive.js:123 Got the File's URL: https://doc-10-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…63125/03280214578542663125/0BwJXpSIJJBiyN1lfOWdZdExZYUk?e=download&gd=true dmp.drive.js:126 File's URL w/ auth: https://doc-10-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…29.vwGdxEUKCOa0lyHJjIZy-hb8f6V2Czocsk4Uwrp5406BqAqNCI9rLcpYhigVWa95s7n74hM dmp.drive.js:123 Got the File's URL: https://doc-14-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…63125/03280214578542663125/0BwJXpSIJJBiyUG9jLUVrTUJLbUU?e=download&gd=true dmp.drive.js:126 File's URL w/ auth: https://doc-14-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…29.vwGdxEUKCOa0lyHJjIZy-hb8f6V2Czocsk4Uwrp5406BqAqNCI9rLcpYhigVWa95s7n74hM

For me, that first url/request (https://content.googleapis.com/drive/v2/files/0BwJXpSIJJBiyQkZGa0RLcTFmUkk) returns the following even now that the song is permanently fixed (perhaps it is the wrong request, or missing a key/credentials?):

{ "error": { "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", "extendedHelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." } }

Console log when I then try to import the single song (could not figure out how to expand the entire line and remove the ellipses, but you should be able to replicate this):

dmp.drive.js:123 Got the File's URL: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…63125/03280214578542663125/0BwJXpSIJJBiyQkZGa0RLcTFmUkk?e=download&gd=true dmp.drive.js:126 File's URL w/ auth: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…29.vwFWUnQXwISrmltdvlgjfSR2Ht8n1mS8WTcMr46B8MkfBOsTRklyZ0KykiDVLzrLCBfc4dQ dmp.drive.js:123 Got the File's URL: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…63125/03280214578542663125/0BwJXpSIJJBiyQkZGa0RLcTFmUkk?e=download&gd=true dmp.drive.js:126 File's URL w/ auth: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…29.vwFWUnQXwISrmltdvlgjfSR2Ht8n1mS8WTcMr46B8MkfBOsTRklyZ0KykiDVLzrLCBfc4dQ dmp.ui.js:298 Trying to look at ID3 tags for: You Make Me Feel....mp3 id3.js:45 Found ID tag type. Using reader: ID3 v2

Playing that song from the playlist, which now works:

Got the File's URL: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…63125/03280214578542663125/0BwJXpSIJJBiyQkZGa0RLcTFmUkk?e=download&gd=true dmp.drive.js:126 File's URL w/ auth: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…29.vwFWUnQXwISrmltdvlgjfSR2Ht8n1mS8WTcMr46B8MkfBOsTRklyZ0KykiDVLzrLCBfc4dQ dmp.drive.js:123 Got the File's URL: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…63125/03280214578542663125/0BwJXpSIJJBiyQkZGa0RLcTFmUkk?e=download&gd=true dmp.drive.js:126 File's URL w/ auth: https://doc-0g-ac-docs.googleusercontent.com/docs/securesc/odsuq6818a7mlmet…29.vwFWUnQXwISrmltdvlgjfSR2Ht8n1mS8WTcMr46B8MkfBOsTRklyZ0KykiDVLzrLCBfc4dQ

Those links download the song for me since they have the appropriate credentials. It appears that the initial request is not authenticated, but if it's a Google Drive API issue with allotting only so many keys per second, why would it work for 100 songs and not 700 slowed down by a factor of 10 or more?

justinbass commented 8 years ago

A few months later, I have found that just importing about 100 songs at a time into any playlist seems to fix/hack the issue permanently.

sauerd commented 6 years ago

@justinbass you seem to be the only person here with the knowledge to address issues. i apologize for hijacking your post, but PLEASE, tell me how to delete playlists. i have made a series of new post regarding the issue that are not receiving any responses.