plex-sync icon indicating copy to clipboard operation
plex-sync copied to clipboard

Cannot read property '$' of undefined

Open sylarevan opened this issue 8 years ago • 15 comments

Hello,

I'm trying to sync 2 servers for one managed user. Server 1 is a Shield TV, with IP 192.168.1.20, while server 2 is my Synology NAS (IP = 192.168.1.2).

Sync works fine for the "admin" user, but when trying with my child managed account, I get:

~> env DRY_RUN=1 plex-sync [email protected]/7,r [email protected]/6,w
Reading data from 192.168.1.20:32400, 192.168.1.2:32400...
Progress:                      | Elapsed: 0.0s | 100%
TypeError: Cannot read property '$' of undefined
    at _callee2$ (/usr/local/lib/node_modules/plex-sync/lib/plex.js:107:57)
    at tryCatch (/usr/local/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:64:40)
    at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:355:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:116:21)
    at step (/usr/local/lib/node_modules/plex-sync/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /usr/local/lib/node_modules/plex-sync/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
    at process._tickCallback (internal/process/next_tick.js:103:7)

Any idea what can be causing this? I'm running plex-sync from my mac, with node installed with brew:

~> node --version
v7.5.0

sylarevan avatar Feb 11 '17 14:02 sylarevan

It's likely that the token is wrong on wrong. I ran into this when I accidentally cut off the last character of my token.

Fmstrat avatar Feb 25 '17 23:02 Fmstrat

I have also this issue For the user of mine the sync is working, with my token

But if I want to sync my wife's account with her token (extracted by the Plex Token Bookmarklet) it gives me the error message.

What should I change?

I tried also the version with MY token and username@ip/section But it was also not working...

alneven avatar Apr 29 '17 10:04 alneven

I'm planning to have much more robust error messages in the next release of plex-sync, but for now that message means that one of the pieces of information is incorrect, which could include:

  • the IP / host
  • the library ID
  • the authentication token

Unfortunately it doesn't tell you which of these (if any) is causing the error. One note though, you mentioned that you tried username@ip/section, but there's only token@ip/section. So you'd want something like your-token@ip/section and wife-token@ip/section.

Again, sorry about the lack of detail into what's going on, should eventually be improved (the next version can auto-detect your wife's token from your login details too, so that should make everything easier).

jacobwgillespie avatar Apr 29 '17 20:04 jacobwgillespie

Thanks!

I can login with her username (as I have created it), and I checked the token with the bookmarklet

What I cannot check is the xml view with her account on any video file So I assum only that the sections under her account have the same number as mine... Even though she has no access to all.

But I need definitely that her watched stats got synced with her watched stats on my 2nd server

One is local if we are at home, in the local number (with really bad upload speeds) 2nd one is for remote plex when we are on the way, or by the parents - where only download speed matters

so, therefore server 1 has to sync all our watched status to the remote available server

alneven avatar Apr 29 '17 21:04 alneven

I still had this issue on my side, and I have not been able to solve it. So far my 2nd Plex server is Off now, but I plan to turn it on again and hope to see everything working well now ;)

sylarevan avatar Apr 30 '17 08:04 sylarevan

I've found the same problem when it's doing a LARGE library. I know I have the token correct because it works for my smaller libraries, so I think it's something to do with the size of the library.

TypeError: Cannot read property '$' of undefined
    at _callee2$ (/usr/lib/node_modules/plex-sync/lib/plex.js:107:57)
    at tryCatch (/usr/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:65:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:303:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/lib/node_modules/plex-sync/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /usr/lib/node_modules/plex-sync/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
    at process._tickCallback (internal/process/next_tick.js:109:7) ```

zenjabba avatar Jun 07 '17 19:06 zenjabba

I'm having this issue as well, the same as alneven. Specifically:

  • My account has the 'view XML' option, and I've pulled my Plex token and can use it to sync successfully.
  • I have shared my server with another user. That user, once logged in to the Plex web interface, doesn't have the 'view XML' option.
  • I've found that second user's Plex token, but when I enter it, I get the "TypeError: Cannot read property '$' of undefined" error when sync'ing.

The only two differences between my account (that works) and this second account (that doesn't work) are:

  • My account is the primary account, the server owner
  • My account is subscribed to Plex Pass but the second account isn't.

Hopefully this helps pinpoint this issue. I saw there's a pull request started (https://github.com/jacobwgillespie/plex-sync/pull/48) for changing the login flow. Is that version in a state where I could test it to see if it resolves this issue?

joshuaswarren avatar Jul 23 '17 13:07 joshuaswarren

I'm having the exact same issue. My primary account works great but my wife's account which is through the My Home feature gives the same error:

plex-sync token@ip-address1/1 token@ip-address2/2
Reading data from ip-address1:32400, ip-address2:32400...

Progress:                      | Elapsed: 0.0s | 100%
TypeError: Cannot read property '$' of undefined
    at _callee2$ (/usr/local/lib/node_modules/plex-sync/lib/plex.js:107:57)
    at tryCatch (/usr/local/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:65:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:303:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/local/lib/node_modules/plex-sync/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /usr/local/lib/node_modules/plex-sync/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
    at run (/usr/local/lib/node_modules/plex-sync/node_modules/core-js/library/modules/es6.promise.js:87:22)
    at /usr/local/lib/node_modules/plex-sync/node_modules/core-js/library/modules/es6.promise.js:100:28
    at flush (/usr/local/lib/node_modules/plex-sync/node_modules/core-js/library/modules/_microtask.js:18:9)
    at nextTickCallbackWith0Args (node.js:419:9)

alustig avatar Jul 31 '17 23:07 alustig

I'm also having the same issue, works fine for my user (the admin/primary account user) but when I use the token from another user that I tracked down in the logs it comes up with the error above. Note: the other users I'm trying to sync are not individual plex accounts with email addresses or plex pass etc they were created using my plex/plex pass account.

brenpearson avatar Dec 14 '17 21:12 brenpearson

Same as others - does not work with other users added to the account (i.e. Home users or Friends). I've tried for a number of accounts and all return the error as others have shown. Would love to know a fix for this

rjblake avatar Dec 31 '17 13:12 rjblake

I got the same error. I got my library IDs from <PLEX_IP>/library/sections?X-Plex-Token=<PLEX_TOKEN> I found out that the error causing this was because I used the Id attribute from the location element. Instead you should use the key attribute from the Directory element.

madslundt avatar Jan 14 '18 09:01 madslundt

@madslundt - does this mean you got it to work for other home users? I did try various tokens, but none worked

rjblake avatar Jan 25 '18 14:01 rjblake

I know this is a two year bump to this issue thread - but I'm having the same issue here in 2020 so maybe someone else is too.

So this was annoying me, I thought it should work and it doesnt when attempting to sync other users between two servers. So i put my coding hat on and added debug output lines to the java code and bingo, found the issue.

Turns out that the plex token is unique on a per server basis for shared users (aka, not for you as the server owner)... The plex token will be different from Server 1, to Server 2. Works fine if you get both tokens :)

AlienXAXS avatar Nov 26 '20 22:11 AlienXAXS

I know this is a two year bump to this issue thread - but I'm having the same issue here in 2020 so maybe someone else is too.

So this was annoying me, I thought it should work and it doesnt when attempting to sync other users between two servers. So i put my coding hat on and added debug output lines to the java code and bingo, found the issue.

Turns out that the plex token is unique on a per server basis for shared users (aka, not for you as the server owner)... The plex token will be different from Server 1, to Server 2. Works fine if you get both tokens :)

I'm actually glad you got this to work, as I'm dealing with the issue as well even though we're 2 years removed from the initial issue. Can you share how you retrieved the tokens for the managed users? I can't seem to figure it out.

BEisem avatar Jul 31 '21 22:07 BEisem

Oh my it was a long time ago, I think i asked my mates to get their tokens via the Chrome F12 menu - perhaps it was part of the http headers, but that's all i remember.

AlienXAXS avatar Aug 01 '21 00:08 AlienXAXS