I gave up on SQLite and swiched to Postgres and it magically started working after months of fighting.