RemiRigal / Plex-Auto-Languages

Automated language selection for Plex TV Shows !
MIT License
409 stars 15 forks source link

[ERROR] A Plex Token is required – However, the token is supplied? #84

Closed m04ndj5xc2u3pn4eow closed 1 year ago

m04ndj5xc2u3pn4eow commented 1 year ago

Hi @RemiRigal , just want to say this is an awesome project!

I'm running into an issue where every time I make changes to the container, (in this case, there was an update recently for this image), and need to restart, it can't find the token. This container was running correctly previously. I also ran into this issue when I restart the container previously. It took a couple of restarts and it just started working.

Server: Synology 920+ Version: 7.2-64570

Error Log:

stdout  plex_auto_languages.exceptions.InvalidConfiguration
stdout      raise InvalidConfiguration
stdout    File "/app/plex_auto_languages/utils/configuration.py", line 113, in _validate_config
stdout      self._validate_config()
stdout    File "/app/plex_auto_languages/utils/configuration.py", line 74, in __init__
stdout      self.config = Configuration(user_config_path)
stdout    File "main.py", line 27, in __init__
stdout      plex_auto_languages = PlexAutoLanguages(args.config_file)
stdout    File "main.py", line 117, in <module>
stdout  Traceback (most recent call last):
stdout  [ERROR] A Plex Token is required
stdout  [INFO] Setting value of parameter PLEX_URL from environment variable

docker-compose.yml:

  plexautolanguages:
    image: remirigal/plex-auto-languages:latest
    container_name: plexautolanguages
    secrets:
      - plex_token
    environment:
      - TZ=Europe/Paris
      - PLEX_URL=http://plex:32400
      - PLEX_TOKEN_FILE=/run/secrets/plex_token
    volumes:
      - /volume1/docker/plexautolanguages:/config
    restart: unless-stopped

secrets:
  plex_token:
    file: /volume1/docker/plexautolanguages/secrets/plex_token

Can you advise? Maybe my setup is incorrect for how it reads the token? But, then how does it work when it is able to read the token?

RemiRigal commented 1 year ago

Hi @m04ndj5xc2u3pn4eow ! Your setup looks indeed correct, try to check the following points:

When PlexAutoLanguages loads the token from a secret file, you will see the following log: [INFO] Getting PLEX_TOKEN from Docker secret

Hope this helps, let me know !

m04ndj5xc2u3pn4eow commented 1 year ago

Hey @RemiRigal , thanks for your quick response.

So checking out the link you mentioned, I saw the docker docs example secret file was a .txt file format. I changed my token file to a .txt file and restarted the container and it was able to read the secret.

Still confused on why changing the file extension worked, I changed it back to what I had previously, restarted the container, and ... it also worked.

I don't understand why messing with the file format makes things work again. If you have any ideas on why, I'd love to know. Thanks again.

RemiRigal commented 1 year ago

You are right, the extension of the file should not matter and there are multiple examples in the official documentation where the file has no extension. Docker was probably using an old secret without overriding it with the new file or something like this, it's hard to tell...

Anyway I'm glad you got it working, enjoy and feel free to share your feedback !