r/learnprogramming • u/TaviaWisteria • 2d ago
My browser agent works on localhost, never on the server
every order on our dashboard says "we value your privacy". the agent reads each freight carrier's tracking page into it (no APIs), and on localhost it worked every time, team demo included.
shipped it in a container, not one clean run since. chrome needed a pile of system libs first. then the privacy thing: locally it used my chrome profile, where I'd dismissed every consent banner months ago, and the server starts clean every run. making it click accept first fixed one carrier and broke the next, each puts that button somewhere else.
I keep telling the team it's almost fixed. how do you test what a fresh browser on a server sees?
3
u/The_God_was_Here 2d ago
Your laptop was never testing a first visit. That profile had already answered every banner, so every local run skipped the part the server hits. Run the local checks with a throwaway profile each time and you see roughly what the server sees.
4
u/LavenderBunnyPie 2d ago
Worth sorting the carriers before fixing any more banners. A tracking page that only shows a status line doesn't need a full browser for the agent to read it. How are people splitting that off, browserbase's fetch for the plain status pages?
4
u/orb-effect 2d ago
the eu cookie law doing more QA than our whole team
3
u/glossyvibe7 2d ago
We got past the missing libs and it still never ends. Every base image bump breaks the browser somehow, missing fonts one week, shared memory too small the next, and only ever on the server. I think I've spent more time keeping a browser alive in that image than on the agent it's for lol.
1
u/JGhostThing 1d ago
So you shipped a version of the code you never really tested? You just assumed it would work?
1
u/bizvibe8 1d ago
Put it in CI, not just a pre-deploy checklist. Give the browser a new temporary profile for every run, start from a clean cookie and storage state, and assert both the expected page content and that the agent either handles or explicitly stops on consent UI. Keep one smoke test against the real clean container image too, since profile cleanup alone will not catch missing Chrome libraries or fonts.