Closed highlabs closed 1 month ago
Should show the notifications
Don't show any notification
After I updated my instance, I started to receive a 500 error from /api/v1/notifications.
/api/v1/notifications
No response
v4.3.0-alpha.5+glitch
This is my docker compose file:
version: '3' services: db: restart: always image: postgres:14-alpine shm_size: 256mb networks: - internal_network healthcheck: test: ['CMD', 'pg_isready', '-U', 'postgres'] volumes: - ./postgres14_volume:/var/lib/postgresql/data environment: - 'POSTGRES_HOST_AUTH_METHOD=trust' redis: restart: always image: redis:7-alpine networks: - internal_network healthcheck: test: ['CMD', 'redis-cli', 'ping'] volumes: - ./redis:/data es: restart: always image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4 environment: - "ES_JAVA_OPTS=-Xms256m -Xmx256m -Des.enforce.bootstrap.checks=true" - "xpack.license.self_generated.type=basic" - "xpack.security.enabled=false" - "xpack.watcher.enabled=false" - "xpack.graph.enabled=false" - "xpack.ml.enabled=false" - "bootstrap.memory_lock=true" - "cluster.name=es-mastodon" - "discovery.type=single-node" - "thread_pool.write.queue_size=1000" networks: - external_network - internal_network healthcheck: test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"] volumes: - ./elasticsearch:/usr/share/elasticsearch/data ulimits: memlock: soft: -1 hard: -1 nofile: soft: 65536 hard: 65536 ports: - '127.0.0.1:9200:9200' web: build: . image: registry.gitlab.com/my_account/repo:latest restart: always env_file: .env.production command: bundle exec puma -C config/puma.rb networks: - external_network - internal_network healthcheck: # prettier-ignore test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] ports: - '127.0.0.1:3000:3000' depends_on: - db - redis - es volumes: - ./public/system:/mastodon/public/system streaming: build: . image: registry.gitlab.com/my_account/repo:latest restart: always env_file: .env.production command: node ./streaming networks: - external_network - internal_network healthcheck: # prettier-ignore test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1'] ports: - '127.0.0.1:4000:4000' depends_on: - db - redis sidekiq: build: . image: registry.gitlab.com/my_account/repo:latest restart: always env_file: .env.production command: bundle exec sidekiq depends_on: - db - redis networks: - external_network - internal_network volumes: - ./public/system:/mastodon/public/system healthcheck: test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"] networks: external_network: internal_network: internal: true
mastodon-web-1 | E, [2024-07-16T09:46:35.340998 #17] ERROR -- : [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] mastodon-web-1 | [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] NoMethodError (undefined method `group_key' for an instance of Notification): mastodon-web-1 | [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] mastodon-web-1 | [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] app/serializers/rest/notification_serializer.rb:17:in `group_key' mastodon-web-1 | [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] app/controllers/api/v1/notifications_controller.rb:17:in `index' mastodon-web-1 | [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] app/controllers/concerns/localized.rb:11:in `set_locale' mastodon-web-1 | [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] lib/mastodon/rack_middleware.rb:9:in `call' mastodon-web-1 | [9e6a3a6b-d674-4414-8bbf-7ec8e6196538] lib/public_file_server_middleware.rb:18:in `call' mastodon-sidekiq-1 | 2024-07-16T09:46:36.563Z pid=7 tid=4ujv class=ActivityPub::ProcessingWorker jid=3c70a44fcf57afeb5fc144b9 INFO: start
This is all ocurrence of "group_key" in my repo:
grep -Rnw 'app/' -e 'group_key' app/models/notification.rb:16:# group_key :string app/models/notification.rb:141: # Notifications that have no `group_key` each count as a separate group. app/models/notification.rb:151: .select('notifications.*', "ARRAY[COALESCE(notifications.group_key, 'ungrouped-' || notifications.id)] groups") app/models/notification.rb:157: .where.not("COALESCE(notifications.group_key, 'ungrouped-' || notifications.id) = ANY(grouped_notifications.groups)") app/models/notification.rb:158: .select('notifications.*', "array_append(grouped_notifications.groups, COALESCE(notifications.group_key, 'ungrouped-' || notifications.id))") app/models/notification.rb:179: .select('notifications.*', "ARRAY[COALESCE(notifications.group_key, 'ungrouped-' || notifications.id)] groups") app/models/notification.rb:185: .where.not("COALESCE(notifications.group_key, 'ungrouped-' || notifications.id) = ANY(grouped_notifications.groups)") app/models/notification.rb:186: .select('notifications.*', "array_append(grouped_notifications.groups, COALESCE(notifications.group_key, 'ungrouped-' || notifications.id))") app/models/notification_group.rb:4: attributes :group_key, :sample_accounts, :notifications_count, :notification, :most_recent_notification_id app/models/notification_group.rb:7: if notification.group_key.present? app/models/notification_group.rb:9: scope = notification.account.notifications.where(group_key: notification.group_key) app/models/notification_group.rb:24: group_key: notification.group_key || "ungrouped-#{notification.id}", app/controllers/api/v2_alpha/notifications_controller.rb:18: render json: @notifications.map { |notification| NotificationGroup.from_notification(notification, max_id: @group_metadata.dig(notification.group_key, :max_id)) }, each_serializer: REST::NotificationGroupSerializer, relationships: @relationships, group_metadata: @group_metadata app/controllers/api/v2_alpha/notifications_controller.rb:22: @notification = current_account.notifications.without_suspended.find_by!(group_key: params[:id]) app/controllers/api/v2_alpha/notifications_controller.rb:32: current_account.notifications.where(group_key: params[:id]).destroy_all app/controllers/api/v2_alpha/notifications_controller.rb:53: .where(group_key: @notifications.filter_map(&:group_key)) app/controllers/api/v2_alpha/notifications_controller.rb:55: .group(:group_key) app/controllers/api/v2_alpha/notifications_controller.rb:56: .pluck(:group_key, 'min(notifications.id) as min_id', 'max(notifications.id) as max_id', 'max(notifications.created_at) as latest_notification_at') app/controllers/api/v2_alpha/notifications_controller.rb:57: .to_h { |group_key, min_id, max_id, latest_notification_at| [group_key, { min_id: min_id, max_id: max_id, latest_notification_at: latest_notification_at }] } app/services/notify_service.rb:189: @notification.group_key = notification_group_key app/serializers/rest/notification_group_serializer.rb:4: attributes :group_key, :notifications_count, :type, :most_recent_notification_id app/serializers/rest/notification_group_serializer.rb:33: range = instance_options[:group_metadata][object.group_key] app/serializers/rest/notification_group_serializer.rb:38: range = instance_options[:group_metadata][object.group_key] app/serializers/rest/notification_group_serializer.rb:43: range = instance_options[:group_metadata][object.group_key] app/serializers/rest/notification_serializer.rb:4: attributes :id, :type, :created_at, :group_key app/serializers/rest/notification_serializer.rb:16: def group_key app/serializers/rest/notification_serializer.rb:17: object.group_key || "ungrouped-#{object.id}"
Did you forget to run database migrations?
Yes, my bad. I didn't see this information on release.
Thanks!
Steps to reproduce the problem
Expected behaviour
Should show the notifications
Actual behaviour
Don't show any notification
Detailed description
After I updated my instance, I started to receive a 500 error from
/api/v1/notifications
.Mastodon instance
No response
Mastodon version
v4.3.0-alpha.5+glitch
Technical details
This is my docker compose file:
This is all ocurrence of "group_key" in my repo: