causefx / Organizr

HTPC/Homelab Services Organizer - Written in PHP
GNU General Public License v3.0
5.1k stars 289 forks source link

Trakt.tv API connection - Slim Application Error #1872

Open StefanBerecz opened 2 years ago

StefanBerecz commented 2 years ago
Organizr Version: V 2.1.2330
Branch: Master
WebServer: Nginx (I think)
Operating System: Synology DSM (Linux based) (Docker)

Problem Description:

When I try to connect Organizr to the Trakt.tv API, following the recommended steps, I get a Slim Application Error code and can't continue.

I've tried tinkering around with different adresses, different browsers, users, deleting cookies and get this result either way. Since I had no problem with the trakt API up until now and didn't find a solution to my problem here on Github nor on Reddit, I would like to ask for help.


Reproduction Steps:
  1. Created new Trakt API and pasted in https://organizr.mydomain.com/api/v2/oauth/trakt as well as 192.XXX.X.XX:Port/api/v2/oauth/trakt
  2. Enter generated Client ID and Client Secret into the Connection Tab of Organizr Trakt Setup
  3. Save and try to connect
  4. New window opens, Trakt asks Allow New Organizr Integration to use your account?
  5. Click Yes
  6. Error pops up

Errors on screen? If so paste here:

> Slim Application Error

The application could not run because of the following error:
Details
Type: GuzzleHttp\Exception\ConnectException
Code: 0
Message: cURL error 6: Could not resolve host: api.trakt.tv (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.trakt.tv/oauth/token
File: /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
Line: 210
Trace

#0 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(158): GuzzleHttp\Handler\CurlFactory::createRejection()
#1 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(110): GuzzleHttp\Handler\CurlFactory::finishError()
#2 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(47): GuzzleHttp\Handler\CurlFactory::finish()
#3 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()
#4 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()
#5 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(64): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()
#6 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#7 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#8 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke()
#9 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#10 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Client.php(331): GuzzleHttp\HandlerStack->__invoke()
#11 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Client.php(107): GuzzleHttp\Client->transfer()
#12 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Client.php(123): GuzzleHttp\Client->sendAsync()
#13 /config/www/organizr/api/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(608): GuzzleHttp\Client->send()
#14 /config/www/organizr/api/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(621): League\OAuth2\Client\Provider\AbstractProvider->getResponse()
#15 /config/www/organizr/api/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse()
#16 /config/www/organizr/api/functions/oauth.php(23): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken()
#17 /config/www/organizr/api/v2/routes/oauth.php(6): Organizr->traktOAuth()
#18 /config/www/organizr/api/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(43): {closure}()
#19 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/Route.php(384): Slim\Handlers\Strategies\RequestResponse->__invoke()
#20 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\Routing\Route->handle()
#21 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\MiddlewareDispatcher->handle()
#22 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/Route.php(341): Slim\MiddlewareDispatcher->handle()
#23 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/RouteRunner.php(84): Slim\Routing\Route->run()
#24 /config/www/organizr/api/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(59): Slim\Routing\RouteRunner->handle()
#25 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\RoutingMiddleware->process()
#26 /config/www/organizr/api/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(107): class@anonymous->handle()
#27 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\ErrorMiddleware->process()
#28 /config/www/organizr/api/v2/index.php(92): class@anonymous->handle()
#29 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): {closure}()
#30 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): class@anonymous->handle()
#31 /config/www/organizr/api/vendor/slim/slim/Slim/App.php(215): Slim\MiddlewareDispatcher->handle()
#32 /config/www/organizr/api/vendor/slim/slim/Slim/App.php(199): Slim\App->handle()
#33 /config/www/organizr/api/v2/index.php(151): Slim\App->run()
#34 {main}
causefx commented 2 years ago

can you ping api.trakt.tv from inside the container?

StefanBerecz commented 2 years ago

docker exec -ti organizr ping api.trakt.tv would be the right command I believe, right?

This gives me: ping: bad address 'api.trakt.tv'

causefx commented 2 years ago

that is correct. seems you have a network issue somewhere.

Sent from my iPhone

On Aug 2, 2022, at 3:47 PM, ralothar @.***> wrote:

 docker exec -ti organizr ping api.trakt.tv would be the right command I believe, right?

This gives me: ping: bad address 'api.trakt.tv'

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

StefanBerecz commented 2 years ago

Alright I guess then I will have to narrow it down. Since I can ping api.trakt.tv from windows command I guess it shouldn't be a router-firewall problem.

Does organizr need another open port apart of the regular one? Lets say I can access organizr through port 8285, would the connection to trakt-api need a different one?

causefx commented 2 years ago

No you don’t need another port. I would suggest searching something along the lines of docker synology network issues.

Sent from my iPhone

On Aug 2, 2022, at 4:03 PM, ralothar @.***> wrote:

 Alright I guess then I will have to narrow it down. Since I can ping api.trakt.tv from windows command I guess it shouldn't be a router-firewall problem.

Does organizr need another open port apart of the regular one? Lets say I can access organizr through port 8285, would the connection to trakt-api need a different one?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

StefanBerecz commented 2 years ago

I see. Well turning off the built in synology-firewall for testing purposes seemed to make it work. So I guess something is blocking that connection. I know it might be a far fetch but do you have an idea what it might be? I've enabled forwarding all connections as well as allowing all protocols on organizrs port and still no luck

StefanBerecz commented 2 years ago

So as it turns out the way the Synologys Firewall is different to what I am used to. I had to manually allow the subnet, the container bridge was bound to, to bypass the firewall. Now I can ping api.trakt.tv through terminal command

--- api.trakt.tv ping statistics ---
25 packets transmitted, 25 packets received, 0% packet loss
round-trip min/avg/max = 6.709/7.858/10.953 ms

Unfortunatley I still get this error when trying to connect to Trakt:


Slim Application Error

The application could not run because of the following error:
Details
Type: GuzzleHttp\Exception\RequestException
Code: 0
Message: cURL error 77: error setting certificate verify locations: CAfile: /config/www/organizr/api/functions/cert/cacert.pem CApath: none (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.trakt.tv/oauth/token
File: /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
Line: 211
Trace

#0 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(158): GuzzleHttp\Handler\CurlFactory::createRejection()
#1 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(110): GuzzleHttp\Handler\CurlFactory::finishError()
#2 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(47): GuzzleHttp\Handler\CurlFactory::finish()
#3 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()
#4 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()
#5 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(64): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}()
#6 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#7 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#8 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke()
#9 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#10 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Client.php(331): GuzzleHttp\HandlerStack->__invoke()
#11 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Client.php(107): GuzzleHttp\Client->transfer()
#12 /config/www/organizr/api/vendor/guzzlehttp/guzzle/src/Client.php(123): GuzzleHttp\Client->sendAsync()
#13 /config/www/organizr/api/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(608): GuzzleHttp\Client->send()
#14 /config/www/organizr/api/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(621): League\OAuth2\Client\Provider\AbstractProvider->getResponse()
#15 /config/www/organizr/api/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse()
#16 /config/www/organizr/api/functions/oauth.php(23): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken()
#17 /config/www/organizr/api/v2/routes/oauth.php(6): Organizr->traktOAuth()
#18 /config/www/organizr/api/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(43): {closure}()
#19 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/Route.php(384): Slim\Handlers\Strategies\RequestResponse->__invoke()
#20 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\Routing\Route->handle()
#21 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\MiddlewareDispatcher->handle()
#22 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/Route.php(341): Slim\MiddlewareDispatcher->handle()
#23 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/RouteRunner.php(84): Slim\Routing\Route->run()
#24 /config/www/organizr/api/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(59): Slim\Routing\RouteRunner->handle()
#25 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\RoutingMiddleware->process()
#26 /config/www/organizr/api/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(107): class@anonymous->handle()
#27 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\ErrorMiddleware->process()
#28 /config/www/organizr/api/v2/index.php(92): class@anonymous->handle()
#29 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): {closure}()
#30 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): class@anonymous->handle()
#31 /config/www/organizr/api/vendor/slim/slim/Slim/App.php(215): Slim\MiddlewareDispatcher->handle()
#32 /config/www/organizr/api/vendor/slim/slim/Slim/App.php(199): Slim\App->handle()
#33 /config/www/organizr/api/v2/index.php(151): Slim\App->run()
#34 {main}

[Go Back](https://dash.ralotharly.me/api/v2/oauth/trakt?code=1d627bc54ee8feedae016ad65de2a6d1920b3e110066b04cd4acecf011532c97&state=ecddd6a9d3bf2d8f3f2784c0fe6792fe#)
causefx commented 2 years ago

try the latest dev release

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.