tubearchivist / tubearchivist-plex

Tube Archivist Plex Integration
GNU General Public License v3.0
123 stars 9 forks source link

[Bug]: Scanner urlopen error Name does not resolve #85

Closed kuzi-moto closed 5 days ago

kuzi-moto commented 5 days ago

I've read the documentation.

Operating System

TrueNAS Scale ElectricEel-24.10.0.2

Your Bug Report

Describe the bug

After installation and configuration, the scanner is unable to detect any media.

Steps To Reproduce

  1. Run through installation of TubeArchivist, and the Plex Scanner/Agent.
  2. Download at least 1 YouTube video.
  3. Scan Library Files on configured library.

Expected behavior

Downloaded YouTube video to appear in library.

Relevant log output

# "Logs/ TubeArchivist Scanner/_root_.scanner.log

2024-11-27 10:40:25,631 [TubeArchivist Scanner] INFO - TubeArchivist scanner started: 2024-11-27 10:40:25,631690
2024-11-27 10:40:25,631 [TubeArchivist Scanner] DEBUG - TA URL: https://mydomain.example.com
2024-11-27 10:40:25,632 [TubeArchivist Scanner] INFO - Attempting to connect to TubeArchivist at https://mydomain.example.com with provided token from `ta_config.json` file.
2024-11-27 10:40:25,634 [TubeArchivist Scanner] ERROR - Error reading or accessing url 'https://mydomain.example.com/api/ping', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:40:25,634 [TubeArchivist Scanner] ERROR - Error connecting to TubeArchivist with URL 'https://mydomain.example.com', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:40:25,635 [TubeArchivist Scanner] INFO - Attempting to connect to TubeArchivist at https://mydomain.example.com with provided token from `ta_config.json` file.
2024-11-27 10:40:25,637 [TubeArchivist Scanner] ERROR - Error reading or accessing url 'https://mydomain.example.com/api/ping', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:40:25,637 [TubeArchivist Scanner] ERROR - Error connecting to TubeArchivist with URL 'https://mydomain.example.com', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:46:01,464 [TubeArchivist Scanner] INFO - TubeArchivist scanner started: 2024-11-27 10:46:01,464138
2024-11-27 10:46:01,464 [TubeArchivist Scanner] DEBUG - TA URL: https://mydomain.example.com
2024-11-27 10:46:01,464 [TubeArchivist Scanner] INFO - Attempting to connect to TubeArchivist at https://mydomain.example.com with provided token from `ta_config.json` file.
2024-11-27 10:46:01,466 [TubeArchivist Scanner] ERROR - Error reading or accessing url 'https://mydomain.example.com/api/ping', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:46:01,466 [TubeArchivist Scanner] ERROR - Error connecting to TubeArchivist with URL 'https://mydomain.example.com', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:46:01,468 [TubeArchivist Scanner] INFO - Attempting to connect to TubeArchivist at https://mydomain.example.com with provided token from `ta_config.json` file.
2024-11-27 10:46:01,469 [TubeArchivist Scanner] ERROR - Error reading or accessing url 'https://mydomain.example.com/api/ping', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:46:01,469 [TubeArchivist Scanner] ERROR - Error connecting to TubeArchivist with URL 'https://mydomain.example.com', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:53:55,509 [TubeArchivist Scanner] INFO - TubeArchivist scanner started: 2024-11-27 10:53:55,509497
2024-11-27 10:53:55,509 [TubeArchivist Scanner] DEBUG - TA URL: https://mydomain.example.com
2024-11-27 10:53:55,509 [TubeArchivist Scanner] INFO - Attempting to connect to TubeArchivist at https://mydomain.example.com with provided token from `ta_config.json` file.
2024-11-27 10:53:55,512 [TubeArchivist Scanner] ERROR - Error reading or accessing url 'https://mydomain.example.com/api/ping', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:53:55,512 [TubeArchivist Scanner] ERROR - Error connecting to TubeArchivist with URL 'https://mydomain.example.com', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:53:55,513 [TubeArchivist Scanner] INFO - Attempting to connect to TubeArchivist at https://mydomain.example.com with provided token from `ta_config.json` file.
2024-11-27 10:53:55,515 [TubeArchivist Scanner] ERROR - Error reading or accessing url 'https://mydomain.example.com/api/ping', Exception: '<urlopen error [Errno -2] Name does not resolve>'
2024-11-27 10:53:55,515 [TubeArchivist Scanner] ERROR - Error connecting to TubeArchivist with URL 'https://mydomain.example.com', Exception: '<urlopen error [Errno -2] Name does not resolve>'

# Container Logs

2024-11-27 16:53:55.374577+00:00The '--refresh' operation is deprecated and will be removed in future versions of Plex Media Server.The '--scan' operation is deprecated and will be removed in future versions of Plex Media Server.
2024-11-27 16:53:55.520087+00:00Error in Python: Running scanner:
2024-11-27 16:53:55.520117+00:00Traceback (most recent call last):
2024-11-27 16:53:55.520127+00:00File "/config/Library/Application Support/Plex Media Server/Scanners/Series/TubeArchivist Series Scanner.py", line 525, in Scan
2024-11-27 16:53:55.520145+00:00TA_CONFIG["online"], TA_CONFIG["version"] = test_ta_connection()
2024-11-27 16:53:55.520154+00:00File "/config/Library/Application Support/Plex Media Server/Scanners/Series/TubeArchivist Series Scanner.py", line 370, in test_ta_connection
2024-11-27 16:53:55.520161+00:00raise e
2024-11-27 16:53:55.520172+00:00URLError: <urlopen error [Errno -2] Name does not resolve>
2024-11-27 16:53:55.520179+00:002024-11-27T16:53:55.520179760Z
2024-11-27 16:53:55.520186+00:00Error in Python: Running scanner:
2024-11-27 16:53:55.520193+00:00Traceback (most recent call last):
2024-11-27 16:53:55.520200+00:00File "/config/Library/Application Support/Plex Media Server/Scanners/Series/TubeArchivist Series Scanner.py", line 525, in Scan
2024-11-27 16:53:55.520219+00:00TA_CONFIG["online"], TA_CONFIG["version"] = test_ta_connection()
2024-11-27 16:53:55.520232+00:00File "/config/Library/Application Support/Plex Media Server/Scanners/Series/TubeArchivist Series Scanner.py", line 370, in test_ta_connection
2024-11-27 16:53:55.520256+00:00raise e
2024-11-27 16:53:55.520290+00:00URLError: <urlopen error [Errno -2] Name does not resolve>
2024-11-27 16:53:55.520310+00:002024-11-27T16:53:55.520310328Z

Anything else?

I have double and triple-checked that the URL is indeed correct. I installed dnsutils in the container, and made sure that the container could resolve the path.

My DNS server is my OPNsense router running AdGuard Home. All subdomains on example.com point to my reverse proxy running Traefik which provides LetsEncrypt certificates for SSL.

I use split DNS, so anything on the internal network should route to the reverse proxy's internal IP. But if somehow it ignores my internal DNS server and uses a public one that provides my external IP address, I have NAT reflection enabled to forward the request to my reverse proxy as well.

It's weird because when I attempt to scan the library files, I can see several DNS requests for mydomain.example.com from the host running Plex. I wonder if the scanner is ignoring my system's DNS settings?

Sorry if this problem is not directly related to the TubeArchivist plugin, feel free to direct me somewhere else.

lamusmaser commented 5 days ago

Let's go over a few starting things.

First, this communication is from Plex to TA. You listed that you can see some DNS traffic coming from the Plex host, which is what I would expect. The dnsutils "in the container" ‐ which container?

The rest looks like it should work. The error is very specific, so it has to be something from Plex's side going out to TA.

One thing to note is that Plex may have its own resolution service, since it is built with Python. That could cause it to not resolve based on the local resolver, but I'm hesitant to say this is the issue if you are seeing some DNS requests from that host.

kuzi-moto commented 5 days ago

The dnsutils "in the container" ‐ which container?

The Plex container, using nslookup to resolve mydomain.example.com.

The rest looks like it should work. The error is very specific, so it has to be something from Plex's side going out to TA.

One thing to note is that Plex may have its own resolution service, since it is built with Python. That could cause it to not resolve based on the local resolver, but I'm hesitant to say this is the issue if you are seeing some DNS requests from that host.

Yeah I can't seem to figure it out 🤷‍♂️ I changed the URL to google.com just to try and that seemed to work, or it at least returned a different error.

What a strange issue...

kuzi-moto commented 5 days ago

Well here's something interesting... I tried setting my TrueNAS nameserver to 1.1.1.1 and restarted my Plex container. Scanned the library files and it worked fine!

Guess there is some weird issue between Plex and my DNS server configuration that I'll have to figure out.

I suppose we can consider this one case-closed as it doesn't have anything to do with TubeArchivist.