Antouane44 / Plex-TvTime

2 stars 0 forks source link

Problème #1

Closed 0utlawActual closed 1 month ago

0utlawActual commented 3 months ago

Bonjour,

J'écris ceci en utilisant un traducteur, alors excusez-moi si ce n'est pas clair à 100 %.

Tout d'abord, je voudrais vous remercier d'avoir créé ceci, c'est très utile et exactement ce que je cherchais.

Je rencontre un problème lorsque j'essaie d'exécuter /usr/local/bin/node --no-deprecation Main.js manuellement depuis le docker pour tester que ma configuration fonctionne. J'obtiens l'erreur suivante.

Configuration enregistrée avec succès.
Connexion avec le serveur Plex réussie.
/PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267
                reject(new Error([
                       ^

Error: Failed to launch the browser process!
[39:39:0719/130805.265578:FATAL:spawn_subprocess.cc(236)] posix_spawn: Permission denied (13)

TROUBLESHOOTING: https://pptr.dev/troubleshooting

    at Interface.onClose (/PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267:24)
    at Interface.emit (node:events:532:35)
    at Interface.close (node:internal/readline/interface:527:10)
    at Socket.onend (node:internal/readline/interface:253:10)
    at Socket.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v22.3.0

J'utilisais avec succès la version Docker sur mon ordinateur portable auparavant, mais mon ordinateur portable est tombé en panne, alors maintenant j'essaie de le recréer sur une autre machine. Je ne comprends pas ce qui a changé. Pourriez-vous s'il vous plaît aider? Merci d'avance

Antouane44 commented 3 months ago

Hi, Can you try defining the rights as follows: chmod -R 755 /PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers To be sure you understand correctly, do you have the error on an image that you created yourself? Or on the image retrieved from dockerhub?

0utlawActual commented 3 months ago

Hi, i was haveing this issue on the docker image that is downloaded from dockerhub when issuing the following command

docker run -d \
    --name plextvtime \
    -v /path/to/folder/config:/PlexTvTime/config \
    -v /path/to/folder/data:/PlexTvTime/data \
    -e crontab="0 5 * * *" \
    antouane44/plextvtime:latest

Unfortunatlly your suggestion did not help

# chmod -R 755 /PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers
# cd /PlexTvTime/main && /usr/local/bin/node --no-deprecation Main.js
Configuration enregistrée avec succès.
Connexion avec le serveur Plex réussie.
/PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267
                reject(new Error([
                       ^

Error: Failed to launch the browser process!
[51:51:0720/120438.275392:FATAL:spawn_subprocess.cc(236)] posix_spawn: Permission denied (13)

TROUBLESHOOTING: https://pptr.dev/troubleshooting

    at Interface.onClose (/PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267:24)
    at Interface.emit (node:events:532:35)
    at Interface.close (node:internal/readline/interface:527:10)
    at Socket.onend (node:internal/readline/interface:253:10)
    at Socket.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v22.3.0

here are the permissions of the all the files in the folder

# cd /PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/
# ls -lah
total 244K
drwxr-xr-x 1 root root 4.0K Jun 16 08:21 .
drwxr-xr-x 1 root root 4.0K Jun 16 08:21 ..
-rwxr-xr-x 1 root root  888 Jun 16 08:21 CLI.d.ts
-rwxr-xr-x 1 root root  755 Jun 16 08:21 CLI.d.ts.map
-rwxr-xr-x 1 root root  14K Jun 16 08:21 CLI.js
-rwxr-xr-x 1 root root 8.4K Jun 16 08:21 CLI.js.map
-rwxr-xr-x 1 root root 2.5K Jun 16 08:21 Cache.d.ts
-rwxr-xr-x 1 root root 1.4K Jun 16 08:21 Cache.d.ts.map
-rwxr-xr-x 1 root root 6.6K Jun 16 08:21 Cache.js
-rwxr-xr-x 1 root root 5.1K Jun 16 08:21 Cache.js.map
drwxr-xr-x 1 root root 4.0K Jun 16 08:21 browser-data
-rwxr-xr-x 1 root root  176 Jun 16 08:21 debug.d.ts
-rwxr-xr-x 1 root root  180 Jun 16 08:21 debug.d.ts.map
-rwxr-xr-x 1 root root  459 Jun 16 08:21 debug.js
-rwxr-xr-x 1 root root  157 Jun 16 08:21 debug.js.map
-rwxr-xr-x 1 root root  306 Jun 16 08:21 detectPlatform.d.ts
-rwxr-xr-x 1 root root  237 Jun 16 08:21 detectPlatform.d.ts.map
-rwxr-xr-x 1 root root 1.9K Jun 16 08:21 detectPlatform.js
-rwxr-xr-x 1 root root 1.3K Jun 16 08:21 detectPlatform.js.map
-rwxr-xr-x 1 root root  252 Jun 16 08:21 fileUtil.d.ts
-rwxr-xr-x 1 root root  226 Jun 16 08:21 fileUtil.d.ts.map
-rwxr-xr-x 1 root root 3.7K Jun 16 08:21 fileUtil.js
-rwxr-xr-x 1 root root 2.1K Jun 16 08:21 fileUtil.js.map
-rwxr-xr-x 1 root root  785 Jun 16 08:21 httpUtil.d.ts
-rwxr-xr-x 1 root root  741 Jun 16 08:21 httpUtil.d.ts.map
-rwxr-xr-x 1 root root 5.4K Jun 16 08:21 httpUtil.js
-rwxr-xr-x 1 root root 3.9K Jun 16 08:21 httpUtil.js.map
-rwxr-xr-x 1 root root 3.0K Jun 16 08:21 install.d.ts
-rwxr-xr-x 1 root root 1.4K Jun 16 08:21 install.d.ts.map
-rwxr-xr-x 1 root root 7.9K Jun 16 08:21 install.js
-rwxr-xr-x 1 root root 6.0K Jun 16 08:21 install.js.map
-rwxr-xr-x 1 root root 2.9K Jun 16 08:21 launch.d.ts
-rwxr-xr-x 1 root root 1.9K Jun 16 08:21 launch.d.ts.map
-rwxr-xr-x 1 root root  13K Jun 16 08:21 launch.js
-rwxr-xr-x 1 root root 9.1K Jun 16 08:21 launch.js.map
-rwxr-xr-x 1 root root  165 Jun 16 08:21 main-cli.d.ts
-rwxr-xr-x 1 root root  126 Jun 16 08:21 main-cli.d.ts.map
-rwxr-xr-x 1 root root  313 Jun 16 08:21 main-cli.js
-rwxr-xr-x 1 root root  204 Jun 16 08:21 main-cli.js.map
-rwxr-xr-x 1 root root 1006 Jun 16 08:21 main.d.ts
-rwxr-xr-x 1 root root  737 Jun 16 08:21 main.d.ts.map
-rwxr-xr-x 1 root root 4.0K Jun 16 08:21 main.js
-rwxr-xr-x 1 root root  687 Jun 16 08:21 main.js.map

To provide some more info, I also tried to run it locally without docker after cloning the repository and was running into the same issue. I had to uninstall and update the version of puppeter to latetest and then it work. You might have to do the same in your docker image that you keep in dockerhub.

Thank you for your time.

0utlawActual commented 3 months ago

Hello, just wondering if you have been able to replicate the issue?

Antouane44 commented 3 months ago

Hello, Sorry for the late response, I was unable to reproduce your errors. When I download the docker image, process works fine.

0utlawActual commented 2 months ago

Hello again,

I checked again, but still same issue. Here are the exact steps I followed using a brand new image pull.

$ cd /home/outlawactual/Plex-TvTime

$ git pull
Already up to date.
$ sudo docker run -d --name plextvtime -v /home/outlawactual/Plex-TvTime/config:/PlexTvTime/config -v /home/outlawactual/Plex-TvTime/data:/PlexTvTime/data -e crontab="0 5 * * *" antouane44/plextvtime:latest
Unable to find image 'antouane44/plextvtime:latest' locally
latest: Pulling from antouane44/plextvtime
fea1432adf09: Pull complete 
5651b5803b18: Pull complete 
3873416e6a33: Pull complete 
8a142b8b0e69: Pull complete 
e6762bf37991: Pull complete 
135774f88b3a: Pull complete 
3727aefe7e27: Pull complete 
d731e87adac4: Pull complete 
b68062dfc128: Pull complete 
8bdae4121d77: Pull complete 
51a245e3e6f7: Pull complete 
24a47772d35c: Pull complete 
f709e8c14837: Pull complete 
b648195b3a2a: Pull complete 
2399639c29ad: Pull complete 
Digest: sha256:19942ec20a1f3a3c841826de7691418b6fb2c70a647be37f3b00ba402563f673
Status: Downloaded newer image for antouane44/plextvtime:latest
0ac2ca86b0142ea734f4fed7008afdffc853190dcf0c12f6773484bc2efa66f7
$ docker exec -it plextvtime /bin/sh
# 
# crontab -l
0 5 * * * cd /PlexTvTime/main && /usr/local/bin/node --no-deprecation Main.js >> /plextvtime.log 2>&1
0 4 * * * tail -n 10000 /plextvtime.log > /plextvtime.log.tmp && mv /plextvtime.log.tmp /plextvtime.log
# cd /PlexTvTime/main && /usr/local/bin/node --no-deprecation Main.js
Configuration enregistrée avec succès.
Connexion avec le serveur Plex réussie.
/PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267
                reject(new Error([
                       ^

Error: Failed to launch the browser process!
[51:51:0813/102213.362434:FATAL:spawn_subprocess.cc(236)] posix_spawn: Permission denied (13)

TROUBLESHOOTING: https://pptr.dev/troubleshooting

    at Interface.onClose (/PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267:24)
    at Interface.emit (node:events:532:35)
    at Interface.close (node:internal/readline/interface:527:10)
    at Socket.onend (node:internal/readline/interface:253:10)
    at Socket.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v22.3.0

I would also like to add, that I got the same error when I tried to run it without docker, just on my system at first. Unfortunately I don't remember the exact steps, but I had to updating some of the dependencies of Node before it started working. it wasn't straightforward and took some troubleshooting. I'm able to successfully use it on my system without docker image now, but docker image still has this issue for me. I don't understand how we are having different results if docker is a contained image.

Thanks again.

0utlawActual commented 2 months ago

I did some more troubleshooting inside the docker image and after these steps I was able to get it to run. Some of them might not be the correct solution, but I tried different things, till it worked.

  1. Update NPM
  2. Update puppeteer
  3. set chmod +x * to all files in /PlexTvTime/main/node_modules_local/node_modules/@puppeteer/browsers/lib/cjs/
  4. # npx puppeteer browsers install chrome
    (node:132) [DEP0056] DeprecationWarning: The util.isString API is deprecated.  Please use typeof arg === "string" instead.
    (Use node --trace-deprecation ... to show where the warning was created)
    chrome@127.0.6533.99 /PlexTvTime/main/node_modules_local/puppeteer/.cache/chrome/linux-127.0.6533.99/chrome-linux64/chrome
  5. # export PUPPETEER_EXECUTABLE_PATH=/PlexTvTime/main/node_modules_local/puppeteer/.cache/chrome/linux-127.0.6533.99/chrome-linux64/chrome

after this, i was able to successfully runcd /PlexTvTime/main && /usr/local/bin/node --no-deprecation Main.js without any errors.

Hope this is helpful

Antouane44 commented 1 month ago

Hi, I just created a new image with the latest version of puppeteer and NPM. Can you confirm that this works well?