Closed GesJeremie closed 3 years ago
After more thinking, we probably want to close this ticket:
It's actually not the job of Workarea to fix RefererParser:Parser.new.parse to take in account android-app://
schemes -- Either way fixing it actually just set TrafficReferrer#uri to something like "android-app://org.telegram.plus". Still useful but you know ...
New versions behave correctly thanks to the rescue introduced in 3.5.0
The only thing worth fixing would be to add the rescue in CurrentReferrer
for 3.4 in a patch since it affects Checkout (current tests are not able to surface this bug).
Anyway, sorry for all the noise :)
I agree that if this is interrupting checkout, it's worth fixing for v3.4. I've made a note for our next sprint. Thanks for bringing it up!
Edit: We probably want to label this not as a
bug
but more asenhancement
(my bad)Describe the bug Sentry is reporting an error for one of our build:
Investigation
RefererParser is a dependency in workarea-core:
s.add_dependency 'referer-parser', '~> 0.3.0'
(https://rubygems.org/gems/referer-parser/versions/0.3.0) and seems to have been introduced in workarea3.4.0-beta1
Some users of this gem are experiencing similar problems: https://github.com/snowplow-referer-parser/referer-parser/issues/131. The gist being that
RefererParser::Parser.new.parse()
is not able to parse referrer "urls" starting withandroid-app://
(ie. The referrer being an android app such as slack, facebook, twitter, ...).Scott Bullard (can't link his github profile) provided a fix for this bug: https://github.com/snowplow-referer-parser/referer-parser/pull/145/commits/737a892f628347a610e5633d62153c8d6518f4e5, however it has never been officially released (merged on
develop
but not onmaster
)Looking at the different versions of Workarea, it seems that 3.5.0 mitigates the bug by rescue-ing the parse result: https://github.com/workarea-commerce/workarea/blob/v3.5.0/core/lib/workarea/visit.rb#L69. However that's not the case for older versions starting from
3.4.0-beta1
to3.5.0-beta1
: https://github.com/workarea-commerce/workarea/blob/v3.4.12/core/app/controllers/workarea/current_referrer.rb#L10 (I couldn't fetch the source code from 3.4.0-beta1¯\_(ツ)_/¯
)It's worth noting that recent builds (>= v3.5.0) will basically not track the android-app referrers since the gem
RefererParser
will raise and therefore will be rescued to an empty hash. It's probably worth fixing since it's a good metric to have (that's what triggered this issue / discussion).Bonus
If anyone is running into the same issue and are not able to upgrade at the moment, here's my fix (v3.4.32):