So here is my temporary solution, given the environment I am building is not a critical production system and only used for testing.
docker compose up -d docker exec -it -u0 pgadmin sed -i "/app\.config\['sessions'] = dict\(\)/a\app\.config\['WTF_CSRF_ENABLED'\] = False" /pgadmin4/pgAdmin4.py After the docker container starts, I am inserting the above Python line to disable Flask from CSRF checking. With this, I can now easily access the app without getting the errors. Simon ________________________________ From: Simon Thorpe <si...@thorpevillage.com> Sent: Tuesday, May 16, 2023 8:17 AM To: Aditya Toshniwal <aditya.toshni...@enterprisedb.com> Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org> Subject: Re: Help with running pgadmin in a docker container Attached... Seems like a csrf problem. A quick google search and it seems that when Docker is https://stackoverflow.com/questions/65233859/dockerize-pgadmin-the-csrf-tokens-do-not-match So I tried accessing the server in Firefox. And it all worked fine. Went back to Chrome, closed all my tabs and accessed the server again, now Chrome works. Logged out on Chrome, and attempted to log back in. Get the errors again. Closed Chrome again, returned to the pgadmin login page and logged in. Works fine. So it seems that upon a logout and return, using the same browser tab, it's failing the csrf check. Should the logout call delete a cookie or something? Simon ________________________________ From: Aditya Toshniwal <aditya.toshni...@enterprisedb.com> Sent: Monday, May 15, 2023 10:36 PM To: Simon Thorpe <si...@thorpevillage.com> Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org> Subject: Re: Help with running pgadmin in a docker container Hi Simon, Can you please share the docker logs for v7? On Tue, May 16, 2023 at 6:21 AM Simon Thorpe <si...@thorpevillage.com<mailto:si...@thorpevillage.com>> wrote: Note, I rolled back and used 6.21 of pgadmin... pgadmin: container_name: pgadmin image: dpage/pgadmin4:6.21 depends_on: - postgresdb environment: - PGADMIN_DEFAULT_PASSWORD=nottherealpassword - PGADMIN_DEFAULT_EMAIL=ad...@domain.com<mailto:ad...@domain.com> ports: - "3004:80" I still get an error, but this time the UX shows a red box lower right with the error... "INTERNAL SERVER ERROR" and then disappears. again a whole load of 400 errors in the browser console. The UX also doesn't show the "Servers" item under the "Browser" heading on the left hand menu. Something not right. Would love some pointers as to how to get it working. I would imagine this would also fail for others as I am using a pretty standard container for both pgadmin and postgres. Simon ________________________________ From: Simon Thorpe <si...@thorpevillage.com<mailto:si...@thorpevillage.com>> Sent: Monday, May 15, 2023 5:40 PM To: pgadmin-support@lists.postgresql.org<mailto:pgadmin-support@lists.postgresql.org> <pgadmin-support@lists.postgresql.org<mailto:pgadmin-support@lists.postgresql.org>> Subject: Help with running pgadmin in a docker container Hi I'm running a postgres server in a docker container and pgadmin in another docker container, i'm using a docker compose file to build them both. I am able to start both containers fine, I can access the pgadmin UI fine. I can login and add a new server, all seems well. I can see and navigate the postgres server via the pgadmin UX. However, if I logout and back in, I cannot use the UX at all. The browser throws a lot of errors and I can't even re-add the server. Not sure what is going on. My environment is the following... services: pgadmin: container_name: pgadmin image: dpage/pgadmin4 depends_on: - postgresdb environment: - PGADMIN_DEFAULT_PASSWORD=nottherealpassword - PGADMIN_DEFAULT_EMAIL=ad...@domain.com<mailto:ad...@domain.com> ports: - "3004:80" postgresdb: image: postgres:15 container_name: postgresdb environment: - POSTGRES_DB=postgres - POSTGRES_PASSWORD=nottherealpassword - POSTGRES_USER=admin volumes: - postgresdb:/var/lib/postgresql/ volumes: postgresdb: When I attempt to relogin, I can authenticate. But the browser throws the errors below. It hints that the local pgadmin database is corrupted (/var/lib/pgadmin/pgadmin4.db?). Any clues as to how I get this working? GET https://pgadmin.skyflash.co/browser/nodes/ 400 app.bundle.js?ver=70100:2 Uncaught (in promise) Error: Node Load Error... at app.bundle.js?ver=70100:2:2318033 at s (app.bundle.js?ver=70100:2:2309094) at Generator.<anonymous> (app.bundle.js?ver=70100:2:2310431) at Generator.next (app.bundle.js?ver=70100:2:2309457) at y (app.bundle.js?ver=70100:2:2315084) at i (app.bundle.js?ver=70100:2:2315287) POST https://pgadmin.skyflash.co/browser/master_password 400 GET https://pgadmin.skyflash.co/browser/check_corrupted_db_file 400 Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=Error%3A%20Request%20failed%20with%20status%20code%20400 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. at xo (vendor.others.js?ver=70100:109:3096293) at vendor.others.js?ver=70100:109:3101114 at Fs (vendor.others.js?ver=70100:109:3112100) at $a (vendor.others.js?ver=70100:109:3157983) at Tl (vendor.others.js?ver=70100:109:3143455) at kl (vendor.others.js?ver=70100:109:3143383) at El (vendor.others.js?ver=70100:109:3143246) at yl (vendor.others.js?ver=70100:109:3140233) at vendor.others.js?ver=70100:109:3089971 at t.unstable_runWithPriority (vendor.others.js?ver=70100:109:3476540) GET https://pgadmin.skyflash.co/misc/bgprocess/ 400 Error: Request failed with status code 400 at e.exports (vendor.others.js?ver=70100:109:168712) at e.exports (vendor.others.js?ver=70100:109:171135) at XMLHttpRequest.v (vendor.others.js?ver=70100:109:164032) Uncaught (in promise) Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=Error%3A%20Request%20failed%20with%20status%20code%20400 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. at xo (vendor.others.js?ver=70100:109:3096293) at vendor.others.js?ver=70100:109:3101114 at Fs (vendor.others.js?ver=70100:109:3112100) at $a (vendor.others.js?ver=70100:109:3157983) at Tl (vendor.others.js?ver=70100:109:3143455) at kl (vendor.others.js?ver=70100:109:3143383) at El (vendor.others.js?ver=70100:109:3143246) at yl (vendor.others.js?ver=70100:109:3140233) at vendor.others.js?ver=70100:109:3089971 at t.unstable_runWithPriority (vendor.others.js?ver=70100:109:3476540) POST https://pgadmin.skyflash.co/settings/store 400 Uncaught (in promise) Error: Request failed with status code 400 at e.exports (vendor.others.js?ver=70100:109:168712) at e.exports (vendor.others.js?ver=70100:109:171135) at XMLHttpRequest.v (vendor.others.js?ver=70100:109:164032) -- Thanks, Aditya Toshniwal pgAdmin Hacker | Sr. Software Architect | enterprisedb.com<https://www.enterprisedb.com/> "Don't Complain about Heat, Plant a TREE"