debug: add middleware-level mobile cookie logging
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

This commit is contained in:
Maciej Pienczyn 2026-03-18 11:05:04 +01:00
parent b1045276d5
commit c94827abcd
2 changed files with 8 additions and 2 deletions

View File

@ -49,8 +49,8 @@ def get_or_create_analytics_session():
'cookie_names': list(request.cookies.keys()), 'cookie_names': list(request.cookies.keys()),
'session_key': analytics_session_id[:8], 'session_key': analytics_session_id[:8],
}) + '\n') }) + '\n')
except Exception: except Exception as _e:
pass logger.error(f"PWA debug write failed: {_e}")
db = SessionLocal() db = SessionLocal()
try: try:

View File

@ -85,6 +85,12 @@ def register_middleware(app):
return return
try: try:
# DEBUG: middleware-level mobile cookie check
_ua = request.headers.get('User-Agent', '').lower()
if 'mobile' in _ua:
with open('/tmp/pwa_debug.log', 'a') as _mf:
_mf.write(f"MIDDLEWARE: path={request.path} pwa_mode={request.cookies.get('pwa_mode')} pwa_display={request.cookies.get('pwa_display')}\n")
from utils.analytics import ( from utils.analytics import (
track_page_view_for_request, track_page_view_for_request,
set_current_page_view_id set_current_page_view_id