Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoMethodError when no request and cookies == :none #554

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rgarner
Copy link

@rgarner rgarner commented Apr 11, 2024

When tracking with no request,

Ahoy.cookies = :none
Ahoy::Tracker.new.track_event(:would_fail)

would raise NoMethodError: undefined method 'remote_ip' for nil. Since we explicitly don't have a request, allow visitor_token_helper to fall back on generate_id by returning nil from visitor_anonymity_set
when there is no request.

@rgarner rgarner changed the title Fix NoMethodError when cookies == :none Fix NoMethodError when cookies == :none Apr 11, 2024
@rgarner rgarner changed the title Fix NoMethodError when cookies == :none Fix NoMethodError when controllerless tracking and cookies == :none Apr 12, 2024
@rgarner rgarner changed the title Fix NoMethodError when controllerless tracking and cookies == :none Fix NoMethodError when no request and cookies == :none Apr 12, 2024
When tracking with no request,

```
Ahoy.cookies = :none
Ahoy::Tracker.new.track_event(:would_fail)
```

would raise NoMethodError: undefined method `remote_ip' for nil.
Since we explicitly don't have a request, allow visitor_token_helper
to fall back on generate_id by returning nil from visitor_anonymity_set
when there is no request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant