Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server error when uploading translations (messages.json) #3449

Open
flodolo opened this issue Nov 19, 2024 · 2 comments · May be fixed by #3312
Open

Server error when uploading translations (messages.json) #3449

flodolo opened this issue Nov 19, 2024 · 2 comments · May be fixed by #3312

Comments

@flodolo
Copy link
Collaborator

flodolo commented Nov 19, 2024

Still same project: pontoon.mozilla.org/it/mozilla-vpn-extension

Trying to upload translations, I get a server error (Oops! Something is wrong. We're going to fix it soon.).
What's strange is that there is nothing in the log about this error.

Tried to switch the project to public (just in case), but it didn't help.

@github-project-automation github-project-automation bot moved this to 🆕 Needs triage in Pontoon Roadmap Nov 19, 2024
@flodolo flodolo changed the title Can't upload translations (messages.json) Server error when uploading translations (messages.json) Nov 19, 2024
@flodolo
Copy link
Collaborator Author

flodolo commented Nov 19, 2024

One more detail: this seems to work fine in my local docker installation (both the sync-refactor branch and main)

@flodolo
Copy link
Collaborator Author

flodolo commented Nov 20, 2024

Correction, I have a traceback (log is just very slow to catch up, and apparently didn't have the patience yesterday)

Main issue: DETAIL: Key (entity_id, locale_id, active)=(313444, 111, t) already exists.

Full log:

 Internal Server Error: /upload/
 Traceback (most recent call last):
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
     return self.cursor.execute(sql, params)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/newrelic/hooks/database_psycopg2.py", line 61, in execute
     return super(CursorWrapper, self).execute(sql, parameters, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/newrelic/hooks/database_dbapi2.py", line 37, in execute
     return self.__wrapped__.execute(sql, parameters,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "entity_locale_active"
 DETAIL:  Key (entity_id, locale_id, active)=(313444, 111, t) already exists.
 The above exception was the direct cause of the following exception:
 Traceback (most recent call last):
   File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
     response = wrapped_callback(request, *callback_args, **callback_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/newrelic/hooks/framework_django.py", line 529, in wrapper
     return wrapped(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
     return view_func(request, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/views/decorators/http.py", line 43, in inner
     return func(request, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/contextlib.py", line 81, in inner
     return func(*args, **kwds)
            ^^^^^^^^^^^^^^^^^^^
   File "/app/pontoon/base/views.py", line 804, in upload
     utils.handle_upload_content(slug, code, part, f, request.user)
   File "/app/pontoon/base/utils.py", line 415, in handle_upload_content
     ).reset_active_translations(locale=locale)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/pontoon/base/models/entity.py", line 463, in reset_active_translations
     ).update(active=True)
       ^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/query.py", line 1206, in update
     rows = query.get_compiler(self.db).execute_sql(CURSOR)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1984, in execute_sql
     cursor = super().execute_sql(result_type)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
     cursor.execute(sql, params)
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
     return self._execute_with_wrappers(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
     return executor(sql, params, many, context)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
     with self.db.wrap_database_errors:
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
     raise dj_exc_value.with_traceback(traceback) from exc_value
   File "/app/.heroku/python/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
     return self.cursor.execute(sql, params)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/newrelic/hooks/database_psycopg2.py", line 61, in execute
     return super(CursorWrapper, self).execute(sql, parameters, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/newrelic/hooks/database_dbapi2.py", line 37, in execute
     return self.__wrapped__.execute(sql, parameters,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 django.db.utils.IntegrityError: duplicate key value violates unique constraint "entity_locale_active"
 DETAIL:  Key (entity_id, locale_id, active)=(313444, 111, t) already exists.
 During handling of the above exception, another exception occurred:
 Traceback (most recent call last):
   File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
     response = get_response(request)
                ^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/base.py", line 199, in _get_response
     response = self.process_exception_by_middleware(e, request)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/base.py", line 362, in process_exception_by_middleware
     response = middleware_method(request, exception)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/newrelic/api/function_trace.py", line 166, in literal_wrapper
     return wrapped(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/pontoon/base/middleware.py", line 31, in process_exception
     return super().process_exception(request, exception)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/raygun4py/middleware/django.py", line 21, in process_exception
     raygun_request = self._mapRequest(request)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/raygun4py/middleware/django.py", line 41, in _mapRequest
     'rawData': request.body if hasattr(request, 'body') else getattr(request, 'raw_post_data', {})
                                ^^^^^^^^^^^^^^^^^^^^^^^^
   File "/app/.heroku/python/lib/python3.11/site-packages/django/http/request.py", line 327, in body
     raise RawPostDataException(
 django.http.request.RawPostDataException: You cannot access body after reading from request's data stream

@eemeli eemeli linked a pull request Nov 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 Needs triage
Development

Successfully merging a pull request may close this issue.

1 participant