jazzband / django-embed-video

Django app for easy embedding YouTube and Vimeo videos and music from SoundCloud.
http://django-embed-video.rtfd.org
MIT License
383 stars 137 forks source link

GraphQL Youtube SSL problem: Max retries exceeded with url ... caused by NewConnectionError #130

Closed cocuriosa closed 2 months ago

cocuriosa commented 4 years ago

Bug Report

Bug Description When I'm develloping locally on my Windows machine, I often get the problem of not being able to open pages that include an embedded youTube video on the app I'm building (running Django in the backend, connecting front- and backend with Graphene/GraphQL). On the production server the problem doesn't exist. I only experience it locally.

Odd Observations My boyfriend - who's developing the same project with me but on his Mac machine - does not have the same problem.

Related Code

django          | [27/Jun/2020 17:41:16] "POST /api/graphql/batch HTTP/1.1" 200 1394
django          | [27/Jun/2020 17:51:23] "POST /api/graphql/batch HTTP/1.1" 200 2135
django          | [27/Jun/2020 17:51:31] "POST /api/graphql/batch HTTP/1.1" 200 1405
django          | [27/Jun/2020 17:55:51] "POST /api/graphql/batch HTTP/1.1" 200 1687
django          | ERROR 2020-06-27 17:56:02,206 utils 8 139665177044736 Traceback (most recent call last):
django          |   File "/usr/local/lib/python3.8/site-packages/promise/promise.py", line 489, in _resolve_from_executor
django          |     executor(resolve, reject)
django          |   File "/usr/local/lib/python3.8/site-packages/promise/promise.py", line 756, in executor
django          |     return resolve(f(*args, **kwargs))
django          |   File "/usr/local/lib/python3.8/site-packages/graphql/execution/middleware.py", line 75, in make_it_promise
django          |     return next(*args, **kwargs)
django          |   File "/usr/local/lib/python3.8/site-packages/graphene/types/resolver.py", line 13, in dict_or_attr_resolver
django          |     return resolver(attname, default_value, root, info, **args)
django          |   File "/usr/local/lib/python3.8/site-packages/graphene/types/resolver.py", line 2, in attr_resolver
django          |     return getattr(root, attname, default_value)
django          |   File "/opt/project/backend/coapp/temple/quests/models.py", line 156, in intro_thumbnail
django          |     return VideoService.get_thumbnail(self.intro_video_url)
django          |   File "/opt/project/backend/coapp/core/utils/videos.py", line 10, in get_thumbnail
django          |     return video.thumbnail
django          |   File "/usr/local/lib/python3.8/site-packages/embed_video/backends.py", line 194, in thumbnail
django          |     return self.get_thumbnail_url()
django          |   File "/usr/local/lib/python3.8/site-packages/embed_video/backends.py", line 347, in get_thumbnail_url
django          |     if int(requests.head(temp_thumbnail_url).status_code) < 400:
django          |   File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 104, in head
django          |     return request('head', url, **kwargs)
django          |   File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
django          |     return session.request(method=method, url=url, **kwargs)
django          |   File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
django          |     resp = self.send(prep, **send_kwargs)
django          |   File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
django          |     r = adapter.send(request, **kwargs)
django          |   File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
django          |     raise ConnectionError(e, request=request)
django          | graphql.error.located_error.GraphQLLocatedError: HTTPSConnectionPool(host='img.youtube.com', port=443): Max retries exceeded with url: /vi/PhiGNbWX0b8/maxresdefault.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f065ca715b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
django          | 
ERROR Error: Uncaught (in promise): Error: GraphQL error: HTTPSConnectionPool(host='img.youtube.com', port=443): Max retries exceeded with url: /vi/PhiGNbWX0b8/maxresdefault.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f065ca715b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Error: GraphQL error: HTTPSConnectionPool(host='img.youtube.com', port=443): Max retries exceeded with url: /vi/PhiGNbWX0b8/maxresdefault.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f065ca715b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
    at new ApolloError (bundle.esm.js:63)
    at bundle.esm.js:1649
    at Object.next (Observable.js:322)
    at notifySubscription (Observable.js:135)
    at onNotify (Observable.js:179)
    at SubscriptionObserver.next (Observable.js:235)
    at bundle.esm.js:866
    at Set.forEach (<anonymous>)
    at Object.next (bundle.esm.js:866)
    at notifySubscription (Observable.js:135)
    at resolvePromise (zone-evergreen.js:798)
    at zone-evergreen.js:705
    at zone-evergreen.js:721
    at ZoneDelegate.invoke (zone-evergreen.js:364)
    at Object.onInvoke (core.js:41654)
    at ZoneDelegate.invoke (zone-evergreen.js:363)
    at Zone.run (zone-evergreen.js:123)
    at zone-evergreen.js:857
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Object.onInvokeTask (core.js:41632)

Hoping for Help I'm quite lost on what to do and would be very appreciative for your help to fixing this issue!