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

cookie named "_plausible_key" exceeds maximum size of 4096 bytes #3762

Closed
2 tasks done
gillbates opened this issue Feb 7, 2024 · 7 comments
Closed
2 tasks done

cookie named "_plausible_key" exceeds maximum size of 4096 bytes #3762

gillbates opened this issue Feb 7, 2024 · 7 comments

Comments

@gillbates
Copy link

Past Issues Searched

  • I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • This is a bug report and not a feature request, nor asking for self-hosted support

Using official Plausible Cloud hosting or self-hosting?

Self-hosting

Describe the bug

version: plausible/analytics:v2.0

it always shows following error when I try to add a new site.

Server: 127.0.0.1:8000 (http)
Request: POST /sites
** (exit) an exception was raised:
    ** (Plug.Conn.CookieOverflowError) cookie named "_plausible_key" exceeds maximum size of 4096 bytes
        (plug 1.14.2) lib/plug/conn.ex:1857: Plug.Conn.verify_cookie!/2
        (plug 1.14.2) lib/plug/conn.ex:1850: anonymous fn/2 in Plug.Conn.merge_headers/2
        (stdlib 4.2) maps.erl:411: :maps.fold_1/3
        (plug 1.14.2) lib/plug/conn.ex:1842: Plug.Conn.run_before_send/2
        (plug 1.14.2) lib/plug/conn.ex:443: Plug.Conn.send_resp/1
        (plausible 0.0.1) lib/plausible_web/controllers/site_controller.ex:1: PlausibleWeb.SiteController.action/2
        (plausible 0.0.1) lib/plausible_web/controllers/site_controller.ex:1: PlausibleWeb.SiteController.phoenix_controller_pipeline/2
        (phoenix 1.7.2) lib/phoenix/router.ex:430: Phoenix.Router.__call__/5
03:33:57.914 [error] #PID<0.29009.1316> running PlausibleWeb.Endpoint (connection #PID<0.27803.1316>, stream id 20) terminated

but the site is listed after I refresh the page, any ideas why?

Expected behavior

we could add site ...

Screenshots

CleanShot 2024-02-07 at 11 38 18@2x

Environment

- OS:
- Browser:
- Browser Version:
@ruslandoga
Copy link
Contributor

ruslandoga commented Feb 7, 2024

👋 @gillbates

Can you please show the contents of the cookie? You can decode it using your local Elixir's iex or bin/plausible remote

$ cd hosting
$ docker compose exec plausible bin/plausible remote
# your cookie would go here, this one is from https://plausible.io/login
iex> cookie = "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYdVZNNkNFVDhHQXBqcjdKUHNPWWJmZi1M.UQCIJm6UNxaBMfzZecxTtOo9YXvVIXDyWUPHfeNARUg"
iex> [_, data, _] = String.split(cookie, ".")
iex> data |> Base.decode64!(padding: false) |> :erlang.binary_to_term
%{"_csrf_token" => "uVM6CET8GApjr7JPsOYbff-L"}

@gillbates
Copy link
Author

gillbates commented Feb 7, 2024

data |> Base.decode64!() |> :erlang.binary_to_term

it shows

{
  "aabbcc14.xyz_offer_email_report" => true,
  "aabbcc21.xyz_offer_email_report" => true,
  "aabbcc58.xyz_offer_email_report" => true,
  "aabbcc19.xyz_offer_email_report" => true,
  "aabbcc05.xyz_offer_email_report" => true,
  "aabbcc56.xyz_offer_email_report" => true,
  "aabbcc09.xyz_offer_email_report" => true,
  "login_dest" => nil,
  "aabbcc57.xyz_offer_email_report" => true,
  "aabbcc.fun_offer_email_report" => true,
  "aabbcc20.xyz_offer_email_report" => true,
  "aabbcc.xyz_offer_email_report" => true,
  "aabbcc27.xyz_offer_email_report" => true,
  "aabbcc28.xyz_offer_email_report" => true,
  "aabbcc30.xyz_offer_email_report" => true,
  "aabbcc53.xyz_offer_email_report" => true,
  "aabbcc39.xyz_offer_email_report" => true,
  "aabbcc38.xyz_offer_email_report" => true,
  "aabbcc50.xyz_offer_email_report" => true,
  "aabbcc02.xyz_offer_email_report" => true,
  "last_seen" => 1707317434,
  "aabbcc15.xyz_offer_email_report" => true,
  "aabbcc04.xyz_offer_email_report" => true,
  "aabbcc24.xyz_offer_email_report" => true,
  "aabbcc51.xyz_offer_email_report" => true,
  "aabbcc11.xyz_offer_email_report" => true,
  "xxx.life_offer_email_report" => true,
  "aabbcc34.xyz_offer_email_report" => true,
  "aabbcc41.xyz_offer_email_report" => true,
  "aabbcc22.xyz_offer_email_report" => true,
  "aabbcc32.xyz_offer_email_report" => true,
  "aabbcc45.xyz_offer_email_report" => true,
  "aabbcc25.xyz_offer_email_report" => true,
  "aabbcc46.xyz_offer_email_report" => true,
  "aabbcc16.xyz_offer_email_report" => true,
  "aabbcc01.xyz_offer_email_report" => true,
  "aabbcc37.xyz_offer_email_report" => true,
  "session_timeout_at" => 1708527034,
  "aabbcc33.xyz_offer_email_report" => true,
  "xxx.xyz_offer_email_report" => true,
  "aabbcc47.xyz_offer_email_report" => true,
  "xxx.fun_offer_email_report" => true,
  "aabbcc10.xyz_offer_email_report" => true,
  "aabbcc23.xyz_offer_email_report" => true,
  "aabbcc07.xyz_offer_email_report" => true,
  "aabbcc08.xyz_offer_email_report" => true,
  "aabbcc48.xyz_offer_email_report" => true,
  "aabbcc49.xyz_offer_email_report" => true,
  "aabbcc35.xyz_offer_email_report" => true,
  "aabbcc31.xyz_offer_email_report" => true,
  ...
}

@ruslandoga
Copy link
Contributor

ruslandoga commented Feb 7, 2024

Could you please provide more context on your setup, do you have all these aabbcc**.xyz websites in your account?

@ruslandoga
Copy link
Contributor

ruslandoga commented Feb 7, 2024

The short term fix would be to log out or delete the _plausible_key cookie and then log back in.

@gillbates
Copy link
Author

gillbates commented Feb 7, 2024

Could you please provide more context on your setup, do you have all these websites in your account?

Yes.

1, I just use docker compose up to up plausible 2.0

CleanShot 2024-02-07 at 23 24 27@2x

2, I start to add sites in web page and everything works as expected.
3, This bug appears today after I added another site. I guess its caused by site count exceeds certain threshold?

@gillbates
Copy link
Author

The short term fix would be to log out or delete the _plausible_key cookie and then log back in.

ok, confirmed working. thx @ruslandoga
expected a fix in future and maybe a search bar in case we have many domains :)

@ruslandoga ruslandoga self-assigned this Feb 17, 2024
aerosol added a commit that referenced this issue Mar 13, 2024
Keeping it within the cookie is problematic, as the banners don't
expire and overflow the cookie with data when enough new sites
are added.

Ref #3762
@ruslandoga ruslandoga removed their assignment Mar 13, 2024
aerosol added a commit that referenced this issue Mar 26, 2024
* Use sessionStorage for offer e-mail report banner tracking

Keeping it within the cookie is problematic, as the banners don't
expire and overflow the cookie with data when enough new sites
are added.

Ref #3762

* Update changelog

* Extract a component

* Make is_dbip evaluate to quoted boolean
@aerosol
Copy link
Member

aerosol commented Mar 26, 2024

Done via #3892

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

No branches or pull requests

3 participants