Closed sentry-io[bot] closed 3 years ago
Hi @noi5e I noticed this error in Sentry after the recent publish to live site. I was wondering if it could be related to some of your new code?
https://sentry.io/share/issue/d051f88028e74c839ac869162ea7eee7/
It apparently affects this page: https://publiclab.org/wiki/betelgeuse-star-%09spectrum/comments
I haven't checked if all wiki comment pages are affected. The URL there looks weird though so maybe that's the issue. Would yo mind taking a look? Thank you!
@jywarren Sure thing! Will take a look today
@jywarren I think this is a URL issue. https://publiclab.org/wiki/betelgeuse-star-%09spectrum/comments leads to a 404
If you look at that URL turns out that %09
is HTML encoding for a horizontal tab. 🤔 That's weird, wonder how that got in there.
If you take out the %09
it does lead to a valid page: https://publiclab.org/wiki/betelgeuse-star-spectrum/comments
Here's the wiki#comments
method that appears in the stacktrace:
https://github.com/publiclab/plots2/blob/0908bfda7ef2462e6b6b61fd8c4654d60f3c3ada/app/controllers/wiki_controller.rb#L467-L470
That means that wiki#show
is called right before wiki's :show
template is rendered right?
Here's wiki#show
for good measure:
https://github.com/publiclab/plots2/blob/0908bfda7ef2462e6b6b61fd8c4654d60f3c3ada/app/controllers/wiki_controller.rb#L21-L86
I think this is what might be happening:
betelgeuse-star-%09spectrum
, a wiki ID that doesn't exist in the DBwiki#comments
calls the wiki#show
methodwiki#show
tries to find the ID, but failsIt could be something about the conditional rendering in wiki#show
that causes a render
or redirect
to be called. This would be on top of the render :show
that wiki#comments
subsequently calls, which would lead to Sentry's particular error. I don't know this for sure, I would have to sit down and closely read the conditionals in wiki#show
to be sure... Or brush up on Rails's controller conventions as well. What do you think?
@jywarren Also check this out, if I visit /wiki/pokemon/comments
in development (which doesn't exist for me locally), I get the same error:
Interestingly, visiting just /wiki/pokemon
(no /comments
), leads here, with no error messages:
So it seems like it's something to do with how wiki#comments
is called for wiki IDs that don't exist.
Also, I'm thinking this isn't caused by changes I made in the codebase, but can dig a little further if we need to confirm 😊. I haven't really touched the wiki
or comment
controllers. I did make some changes to comment
controllers in react-comments
, but that hasn't been merged to main
yet.
OK, i think we are OK then, i'll close this. We often get some uptick in issues after publishing latest code, so I try to be vigilant but this just seems like someone accidentally entered misencoded text as a URL or maybe a bot did it...
Thank you so much for looking into it. 🎉
Sentry Issue: PLOTS2-16F