Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Slack access token length issue (#3016)
# What this PR does fix the following error caused by too short varchar length of database fields `access_token` and `bot_access_token` in table `slack_slackteamidentity` ``` 2023-09-12 18:34:07.448 | django.db.utils.DataError: value too long for type character varying(100) | -- | -- | -- | | 2023-09-12 18:34:07.448 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.448 | return self.cursor.execute(sql, params) | | | 2023-09-12 18:34:07.448 | File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute | | | 2023-09-12 18:34:07.448 | raise dj_exc_value.with_traceback(traceback) from exc_value | | | 2023-09-12 18:34:07.448 | File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 90, in __exit__ | | | 2023-09-12 18:34:07.448 | with self.db.wrap_database_errors: | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in _execute | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return executor(sql, params, many, context) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 66, in execute | | | 2023-09-12 18:34:07.447 | cursor.execute(sql, params) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | cursor = super().execute_sql(result_type) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1559, in execute_sql | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return query.get_compiler(self.db).execute_sql(CURSOR) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 802, in _update | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return filtered._update(values) > 0 | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 912, in _do_update | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | updated = self._do_update(base_qs, using, pk_val, values, update_fields, | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 858, in _save_table | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | updated = self._save_table( | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 776, in save_base | | | 2023-09-12 18:34:07.447 | self.save_base(using=using, force_insert=force_insert, | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 739, in save | | | 2023-09-12 18:34:07.447 | self.save() | | | 2023-09-12 18:34:07.447 | File "/etc/app/apps/slack/models/slack_team_identity.py", line 72, in update_oauth_fields | | | 2023-09-12 18:34:07.447 | slack_team_identity.update_oauth_fields(user, organization, response) | | | 2023-09-12 18:34:07.447 | File "/etc/app/apps/social_auth/pipeline.py", line 102, in populate_slack_identities | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | result = func(*args, **out) or {} | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_core/backends/base.py", line 118, in run_pipeline | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_core/backends/base.py", line 86, in pipeline | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return self.pipeline(pipeline, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_core/backends/base.py", line 83, in authenticate | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | user = backend.authenticate(request, **credentials) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 76, in authenticate | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return func(*func_args, **func_kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/views/decorators/debug.py", line 42, in sensitive_variables_wrapper | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return authenticate(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_django/strategy.py", line 105, in authenticate | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return self.strategy.authenticate(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/etc/app/apps/social_auth/backends.py", line 100, in do_auth | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return func(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_core/utils.py", line 253, in wrapper | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return self.do_auth(access_token, response=response, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/etc/app/apps/social_auth/backends.py", line 88, in auth_complete | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return func(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_core/utils.py", line 253, in wrapper | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return self.auth_complete(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_core/backends/base.py", line 39, in complete | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | user = backend.complete(user=user, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_core/actions.py", line 49, in do_complete | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | result = do_complete( | | | 2023-09-12 18:34:07.447 | File "/etc/app/apps/api/views/auth.py", line 52, in overridden_complete_slack_auth | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return func(request, backend, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/social_django/utils.py", line 46, in wrapper | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return view_func(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | response = view_func(request, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return func(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/rest_framework/decorators.py", line 50, in handler | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | response = handler(request, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch | | | 2023-09-12 18:34:07.447 | raise exc | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception | | | 2023-09-12 18:34:07.447 | self.raise_uncaught_exception(exc) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | response = self.handle_exception(exc) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return self.dispatch(request, *args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 70, in view | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return view_func(*args, **kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | response = wrapped_callback(request, *callback_args, **callback_kwargs) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 181, in _get_response | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | response = get_response(request) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 47, in inner | | | 2023-09-12 18:34:07.447 | Traceback (most recent call last): | | | 2023-09-12 18:34:07.447 | | | | 2023-09-12 18:34:07.447 | The above exception was the direct cause of the following exception: | | | 2023-09-12 18:34:07.447 | | | | 2023-09-12 18:34:07.447 | | | | 2023-09-12 18:34:07.447 | psycopg2.errors.StringDataRightTruncation: value too long for type character varying(100) | | | 2023-09-12 18:34:07.447 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | 2023-09-12 18:34:07.447 | return self.cursor.execute(sql, params) | | | 2023-09-12 18:34:07.447 | File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute | | | 2023-09-12 18:34:07.447 | Traceback (most recent call last): | | | 2023-09-12 18:34:07.447 | 2023-09-12 10:34:07 source=engine:app google_trace_id=50a15245db9b828e0ab33e8d115dd10a/3838538413005063100 logger=django.request Internal Server Error: /api/internal/v1/complete/slack-install-free/ ``` --------- Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
- Loading branch information