User Messages Inbox Error 500

This is only called on secure uploads. My guess is that in the past you had it configured and since you have removed this.

What does this return?

./launcher enter app
rails c
> Upload.where('secure').count

cc @martin

(also we have a naming bug on site_setting.rb:157:in absolute_base_url' It should be called s3_absolute_base_url )

1 Like

Hey Sam,

thank you very much for taking a look into that!

Well as far as I know we did not activate the secure upload feature. But as fas as I am not the only admin I can not be sure about that. And if I am getting it right, your count should return 0 when the feature has never been activated? Well, it is a lot more than 0 :wink: 235 in fact :blush:

This returns

[1] pry(main)> Upload.where('secure').count
=> 235
[2] pry(main)> 

Is there anything I can do to fix that?

Should I deactivate the seucure media allow embeded images in emails setting?

Is it worth to try ti activate secure media and then to deactivate that?

Thank you so much for trying to help out here!

1 Like

If you do not currently have secure media enabled you don’t need to enable it. It must have been enabled at some point because of how many secure uploads you have. Try running the uploads:secure_upload_analyse_and_update rake task; this will go through all your uploads and mark them as secure/not secure based on site settings (if you have secure media disabled they will all be marked as not secure).


Hey Martin,

thanks a lot. I will give this a try tonight.

Just to get you right. We have currently activated

Should we toggle this option too? Or does this not affect the marking process?

And just to be clear, after the rake command, do I habe to rebuild app? Or is this not necessary, but maybe recommended?

Thanks so much!

This option is enabled by default, but it does nothing unless secure media is enabled.

I don’t think a rebuild is necessary, I have run this on live sites with no problems.

1 Like

Thank you so much!

I give it a shot and will report tomorrow.


1 Like

I’m guessing, but the backtrace looks like it’s trying to serialise a list of messages, or a list of information from messages, and is failing when it comes to serialise a particular image. The image is presumably the profile image of a user. Only one account is affected, so perhaps the bad image is for a user who only communicated with this affected account.

Possibly the failing list construction is for the most recent N messages. Perhaps you could send N messages (with different topic titles) to the afflicted account, so the list only contains good messages?


Martin thanks again for the tip.

Well I tried to run rake uploads:secure_upload_analyse_and_update but the output was

This task only works for external storage.

So I tried to active the activate secure media option. But unfortunately or lets say for the sake of avoiding admin errors. This option can only be activated by configuring Amazon S3 buckets. And I am absolutely sure that no one ever made a S3 setup before.

So I can not run the rake script because I do not have any S3 Storage available. So I can’t say if it has an effect on the pry(main)> Upload.where('secure').count

I am wondering why we still have some secure uploads when we never had S3 activated?

Any clues on that.

But in fact

Did the trick. So I am fine for now. Even if I have no clue why we are experiencing such behavior. I would be happy to learn what else could be the reason.

Thanks in advance and for all your time you already spent.

Well Ed_S what can I say besides


In fact your little hint did the trick. I just wrote one new message and posted another answer and then the error disappeared.

Even being my hero for the moment does not free you from further questions :wink: I hope you are OK with giving me some more understanding of what in hell happened here.

First of all to give me a better understanding of how to read the logs. I mean, what a great guess you made. What did you lead to think about a serialization problem might be the one breaking it?

lib/url_helper.rb:90:in `cook_url'
app/models/topic.rb:126:in `image_url'
app/serializers/listable_topic_serializer.rb:34:in `image_url'

Why not the cook_url or I do not know, anything else?

Secondly what are your consumptions, do I have to be aware of running in such a problem again? Or maybe with another user?

Do you think there is a way to narrow it down which message, user, image could be the bad guy here. Is there any other chance to take a look into that than … clicking through the messages and hoping to get a effect on one of the private messages posts?

The funny thing is that some admins just did the exact same thing, like writing a new message (topic) to the affected account and we did experience any other behavior. Somehow the last sent message from me to the affected account did the trick.

And the last one, can I have your phone number for further emergency shout outs? Just kidding! :wink:

But for real, thanks a lot, a lot lot, a lot lot lot. I really got stuck here an I am so glad that our user – as I mentioned, one of our admins – can get back on track. Thank you Ed_S!


Very nice guess !

1 Like

Ha ha - seems like I got lucky. The thing about a stack trace is that it runs from the specific to the general - it’s not just a list of things, but a picture of the nested interactions from general code down to the specific machinery. So, the ‘image’ idea seemed interesting, because there are only profile images in the message list. And I think we’ve seen odd issues with profile images before.

But I have no idea why the code is looking at secure storage, if you’ve never used it.

I suspect a database query could list the images which would be fetched in this case, but I don’t know how you might find the rogue profile. If indeed, this is the story behind the stack trace.


There is a rake task to fix this:

./launcher enter app
rake uploads:secure_upload_analyse_and_update

I recommend you run that.