f1r4s
(Eddie)
January 10, 2022, 10:00pm
1
Hello,
I have issue with badge section, i have modified some badges and add some images there; after 6 months i restore a backup and everything works fine execpt the badge section; i try to login with safe-mode and disable all plugins… but issue still same, how can i restore the badge sections withd default name and images ?
error show me
Message (2 copies reported)
NoMethodError (undefined method `url' for nil:NilClass)
app/models/badge.rb:306:in `image_url'
(eval):10:in `_fast_attributes'
app/controllers/application_controller.rb:484:in `serialize_data'
app/controllers/badges_controller.rb:30:in `index'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'
Backtrace
app/models/badge.rb:306:in `image_url'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:99:in `block in attribute'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/array_serializer.rb:89:in `block in _serializable_array'
active_model_serializers (0.8.4) lib/active_model/array_serializer.rb:79:in `map'
active_model_serializers (0.8.4) lib/active_model/array_serializer.rb:79:in `_serializable_array'
Env
HTTP HOSTS: site.com
1 Like
cocococosti
(Constanza Abarca)
January 11, 2022, 7:19pm
2
Other images were restored correctly?
Did you make sure to include uploads in the backup?
Are you using s3 to store your uploads? If not, could you enter the container, and go to /shared/uploads/default/original/1X
do you have files there?
1 Like
f1r4s
(Eddie)
January 11, 2022, 7:24pm
3
yes i don’t use s3, and i always use to include attachment pictures in backup…
what i’m looking for now how to make reset for badge images ??
cocococosti
(Constanza Abarca)
January 11, 2022, 7:47pm
4
Out of the box, there is no way to “make reset for badge images” that I know of.
What I’d do first is check that the badges missing images were at least restored. If you check the badges
table you can get the ID of the image at the image_upload
field. Then use that ID in the uploads
table, to get the URL of the image, like so:
select url from uploads where id = <badge-upload-id>
The URL looks something like this: /uploads/default/original/1X/c1325294cd04ae6e9072a2577543dad66cf31afe.jpeg
and from there, you can extract the name of the file, in this case it would be c1325294cd04ae6e9072a2577543dad66cf31afe.jpeg
Then you can check in the server that the image is there with find
or whatever method you prefer
cd /
find . -name c1325294cd04ae6e9072a2577543dad66cf31afe.jpeg
Once you made sure the images were restored, at the right path, then you can continue debugging as the issue is somewhere else.
The version of Discourse from the backup is too different from the version of Discourse you are restoring into?
Maybe someone else in the community knows more about this, though.
1 Like
f1r4s
(Eddie)
January 11, 2022, 7:52pm
5
Perfect, but how can i know the missing badge url or name ?
I cannot find how i know the missing url or badge image name.
cocococosti
(Constanza Abarca)
January 11, 2022, 7:57pm
6
Follow the instruction here Data Explorer Plugin to install the data explorer plugin, you can use it to inspect the badges table. Focus on your custom badges.
1 Like
f1r4s
(Eddie)
January 11, 2022, 7:59pm
7
I did install it; but i didn’t find the badge table;
this is the error i get when i open the profile of administrator;
Message
NoMethodError (undefined method `url' for nil:NilClass)
app/models/badge.rb:306:in `image_url'
(eval):10:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
app/controllers/users_controller.rb:92:in `block (2 levels) in show'
app/controllers/users_controller.rb:89:in `show'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'
Backtrace
app/models/badge.rb:306:in `image_url'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:99:in `block in attribute'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:448:in `block in merge_association'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `each'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `merge_association'
Env
HTTP HOSTS: site.com
Hi @f1r4s
I faced the same problem. Did you manage to solve this problem?
I believe this was resolved in this topic:
I have this issue since a month; but i try several time upgrade; migrate the database to new one; etc… with no fix.
It was in admin user; i try to migrate the admin data to new one; same issue… i cannot open the preference or profile and i get 404;
i see same issue but none explain how to fix and it’s quit old since 3 years.
same issue and they mention it’s fixed but too old and none explaine how to fix.
1 Like