Skip to content

Error recording page view: key not found: "request_hash" #18

@vroomanj

Description

@vroomanj

This gem is working beautifully in my development (SQLite3) environment. However, I just pushed it to my production (Postgresql) environment and it's no longer recording any information to the database, instead erroring out with:

key not found: "request_hash"

I don't have any sort of complex configuration of the gem. My controller action is just the following:

    def record_page_view
      return if !request.format.html? && !request.format.json?

      RailsLocalAnalytics.record_request(request: request)
    rescue => e # Add error handling
      # Log the error or handle it gracefully
      puts "Error recording page view: #{e.message}"
    end

The tables do exist:

index_db=# SELECT * FROM tracked_requests_by_day_page;
 id | day | total | url_hostname | url_path | referrer_hostname | referrer_path
----+-----+-------+--------------+----------+-------------------+---------------
(0 rows)
index_db=# SELECT * FROM tracked_requests_by_day_site;
 id | day | total | url_hostname | platform | browser_engine
----+-----+-------+--------------+----------+----------------
(0 rows)

The views all exist at /admin/analytics (just without any data obviously).

I'm trying to think of any additional details I can provide. I've fiddled with some settings:

RailsLocalAnalytics.config.background_jobs = false
and
RailsLocalAnalytics.config.background_jobs = true

I've tried with and without the following in my application.rb:

config.active_job.queue_adapter = :async

Have you encountered this problem before or do you have any advice? I can provide any additional requested information as well. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions