Open KNejad opened 4 years ago
Yes, I'm having the same error but in a standard Rails App. The gem was working fine in my Film model, updating the impressions correctly, but suddenly I get the undefined method 'cookie_value' for "60cb104e4befe185a8b81aac9a2c5e3c":String
It seems like it has something to do with the session_hash.
impressionist (2.0.0) app/controllers/impressionist_controller.rb:143:in session_hash' impressionist (2.0.0) app/controllers/impressionist_controller.rb:60:in
associative_create_statement'
impressionist (2.0.0) app/controllers/impressionist_controller.rb:27:in impressionist' app/controllers/films_controller.rb:28:in
show'
Not sure how to solve this. Would appreciate any insights.
Same error here but only on a mobile device on a standard Rails App.
Me too, same error when using direct url in Incognito mode (need go to main page to resolve)
@KNejad does https://github.com/charlotte-ruby/impressionist/pull/294 fixe your issue?
Hi @rzjfr unfortunately this doesn't seem to be working for me. I installed your version of the gem and I'm getting this error:
NoMethodError (undefined method `id' for #<Hash:0x00007f06f489fe70>):
impressionist (9092d938ab45) app/controllers/impressionist_controller.rb:152:in `session_hash'
impressionist (9092d938ab45) app/controllers/impressionist_controller.rb:68:in `associative_create_statement'
impressionist (9092d938ab45) app/controllers/impressionist_controller.rb:140:in `direct_create_statement'
impressionist (9092d938ab45) app/controllers/impressionist_controller.rb:46:in `impressionist_subapp_filter'
impressionist (9092d938ab45) app/controllers/impressionist_controller.rb:8:in `block in impressionist'
When I print session
from the controller this is what's returned:
{"warden.user.user.key"=>#<User email: "my@email.com", ...>}
@KNejad you can try my version in #293
@KNejad if it's possible to share your Gemfile.lock
I can have a look
@lusinh oh yes sorry I didn't realize there were another version. I did that not specifically for this issue
Hey @rzjfr just attached the Gemfile.lock (renamed to Gemfile.lock.txt because of GitHub filetype restrictions). I had to lightly edit it to remove a couple of private gems and sources, but I didn't change much. It could just be caused by a strange configuration on our side. So if it's working for other API only apps then don't worry about closing this issue if you think that's the case.
@lusinh I tried your branch as well. Got the same error, the error seems to be happening before all the lines both of you edited
@KNejad were you able to get it working? I think this might be a similar issue to what I'm experiencing here.
Hi @GraemeHarrison, no I don't think I ever did. We ended up doing a simple version of what impressionist does in house in the end (basically a hook in the controller followed by saving requests to the DB) since it was good enough for our use case, so I haven't used the gem since posting the issue.
Error still persists.
I had that issue when I tried to share url on facebook. Solution was to check if request is xhr. this was my solution and I don't have that issue anymore
I had a same problem and downgraded gem version, and then solved it!
gem 'impressionist', '~> 1.6.1'
Same issue here with rails 6
Issue still exists Had the same error in incognito mode and RSpec system tests
# Quick fix
def show
...
if session.id.present?
impressionist @question, nil, unique: %i[impressionable_type impressionable_id session_hash]
end
end
Hey @stadniklksndr the problem of your solution is that we lost the tracking for that users. The error only appears on mobile. On desktop is working like a charm.
Me, too. I've got this error message. Does anybody tried to fix it?
I'm getting the above error on my API only Rails project.
I think the issue is because we are running an API only Rails App without any cookies, and Impressionist is expecting to be able to retrieve the
cookie_value
fromrequest.session_options[:id]
, which isnil
for us.Is there any way to handle this case without requiring cookies? Have I made a mistake here?
If not, would there be any interest in a PR to enable support for API only Rails projects without sessions? If so I'd be happy to implement this. Based on what I've seen it shouldn't be too hard.
This is the full stack for the impressionist part of the error: