rust-lang / infra-team

Coordination repository for the Rust infra team
Apache License 2.0
14 stars 8 forks source link

Fix broken Pontoon instance #91

Open jdno opened 8 months ago

jdno commented 8 months ago

Pontoon is a tool to translate websites into other languages. The Rust project maintains its own fork of Pontoon (rust-lang/pontoon) and an instance at https://pontoon.rust-lang.org/, which is used to translate the website.

In May 2022, users reported^1 for the first time that authentication with GitHub was broken. Pontoon redirects the user to GitHub, where they allow the app access to their account, but Pontoon is not able to handle the redirect back successfully.

Gif showing failing authentication ![pontoon](https://github.com/rust-lang/infra-team/assets/865550/ad9482b6-2a9a-4fc7-9467-2e2d6c407e32)

The server throws an Internal Server Error: /accounts/github/login/callback/ when trying to access the id field in the request.

Error in server logs ``` 2022-05-08T16:47:34.495776+00:00 app[web.1]: Internal Server Error: /accounts/github/login/callback/ 2022-05-08T16:47:34.495784+00:00 app[web.1]: Traceback (most recent call last): 2022-05-08T16:47:34.495785+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 41, in inner 2022-05-08T16:47:34.495785+00:00 app[web.1]: response = get_response(request) 2022-05-08T16:47:34.495787+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 187, in _get_response 2022-05-08T16:47:34.495788+00:00 app[web.1]: response = self.process_exception_by_middleware(e, request) 2022-05-08T16:47:34.495788+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 185, in _get_response 2022-05-08T16:47:34.495789+00:00 app[web.1]: response = wrapped_callback(request, *callback_args, **callback_kwargs) 2022-05-08T16:47:34.495789+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/newrelic/hooks/framework_django.py", line 544, in wrapper 2022-05-08T16:47:34.495789+00:00 app[web.1]: return wrapped(*args, **kwargs) 2022-05-08T16:47:34.495790+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 73, in view 2022-05-08T16:47:34.495790+00:00 app[web.1]: return self.dispatch(request, *args, **kwargs) 2022-05-08T16:47:34.495790+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 134, in dispatch 2022-05-08T16:47:34.495791+00:00 app[web.1]: response=access_token) 2022-05-08T16:47:34.495792+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/allauth/socialaccount/providers/github/views.py", line 35, in complete_login 2022-05-08T16:47:34.495792+00:00 app[web.1]: request, extra_data 2022-05-08T16:47:34.495792+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/allauth/socialaccount/providers/base.py", line 86, in sociallogin_from_response 2022-05-08T16:47:34.495793+00:00 app[web.1]: uid = self.extract_uid(response) 2022-05-08T16:47:34.495794+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/allauth/socialaccount/providers/github/provider.py", line 38, in extract_uid 2022-05-08T16:47:34.495794+00:00 app[web.1]: return str(data['id']) 2022-05-08T16:47:34.495795+00:00 app[web.1]: KeyError: 'id' ```

Our fork hadn't been updated since March 2020, and trying to forward it in June 2022 failed due to issues with the database schema.

psycopg2.errors.UndefinedColumn: column base_locale.pretranslated_strings does not exist

Running the database migrations failed as well, since they had been squashed some time between March '20 and June '22.

It was suggested in Pontoon's forum to try to forward to the parent commit of the squash, apply the migrations at that time, and then forward again to catch up with the upstream repository.

We didn't find the time to do that last year and since then the issue has seen no progress.

jdno commented 8 months ago

After fixing the issue and updating our fork to follow upstream, we should have a discussion whether we want to maintain a fork in the first place. The diff between our fork and upstream is very small, and it does not feel worth the effort to maintain it for two small changes.