Description
When POSTGRES_CONNECTION_STRING contains ?sslmode=disable, the processor service
fails to initialize the DatabaseSessionService because the asyncpg driver does not
accept the sslmode keyword argument. This causes agent test chat to return 503 or
"Authentication service error".
Affected Service
evo-ai-processor-community
Steps to Reproduce
- Deploy
evo-ai-processor-community with:
POSTGRES_CONNECTION_STRING=postgresql://user:pass@host:5432/db?sslmode=disable
- Start the processor service
- Navigate to Agents → Test your agent
- Send any message
Expected Behavior
Processor connects to database, sessions are created and agent responds normally.
Actual Behavior
Service crashes on startup with:
TypeError: connect() got an unexpected keyword argument 'sslmode'
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async
driver to be used. The loaded 'psycopg2' is not async.
ValueError: Failed to create database engine for URL
'postgresql+psycopg2://user:pass@host:5432/db'
(psycopg2.errors.UndefinedTable) relation "sessions" does not exist
Agent test returns 503 Service Unavailable or "Authentication service error".
Workaround
Remove sslmode from the connection string:
# ❌ Breaks
POSTGRES_CONNECTION_STRING=postgresql://user:pass@host:5432/db?sslmode=disable
# ✅ Works
POSTGRES_CONNECTION_STRING=postgresql://user:pass@host:5432/db
Root Cause
The DatabaseSessionService from google.adk uses asyncpg internally. The sslmode
parameter is not a valid keyword argument for asyncpg's connect() method. Additionally,
using postgresql+psycopg2:// prefix also fails because asyncpg requires an async driver.
Suggested Fix
- Document in
.env.example that sslmode must not be included in
POSTGRES_CONNECTION_STRING
- Or strip unsupported parameters automatically before passing to the engine
- Or add a startup validation with a clear error message
Environment
- OS: Ubuntu 22.04
- Docker: Swarm (self-hosted)
- Service Image:
evoapicloud/evo-ai-processor-community:latest
- Related: evo-crm-community#50
TypeError: connect() got an unexpected keyword argument 'sslmode'
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'psycopg2' is not async.
ValueError: Failed to create database engine for URL 'postgresql+psycopg2://postgres:***@evo-crm-postgres:5432/evo_community'
(psycopg2.errors.UndefinedTable) relation "sessions" does not exist
sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place?
Error searching for session b4a917bc-0fb6-43ed-9916-af0397d62dff: connect() got an unexpected keyword argument 'sslmode'
src.services.adk.runners.standard_runner - ERROR - Internal error processing request: 500: Error searching for session: connect() got an unexpected keyword argument 'sslmode'
Description
When
POSTGRES_CONNECTION_STRINGcontains?sslmode=disable, the processor servicefails to initialize the
DatabaseSessionServicebecause the asyncpg driver does notaccept the
sslmodekeyword argument. This causes agent test chat to return 503 or"Authentication service error".
Affected Service
evo-ai-processor-communitySteps to Reproduce
evo-ai-processor-communitywith:POSTGRES_CONNECTION_STRING=postgresql://user:pass@host:5432/db?sslmode=disableExpected Behavior
Processor connects to database, sessions are created and agent responds normally.
Actual Behavior
Service crashes on startup with:
TypeError: connect() got an unexpected keyword argument 'sslmode'
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async
driver to be used. The loaded 'psycopg2' is not async.
ValueError: Failed to create database engine for URL
'postgresql+psycopg2://user:pass@host:5432/db'
(psycopg2.errors.UndefinedTable) relation "sessions" does not exist
Agent test returns 503 Service Unavailable or "Authentication service error".
Workaround
Remove
sslmodefrom the connection string:Root Cause
The
DatabaseSessionServicefromgoogle.adkuses asyncpg internally. Thesslmodeparameter is not a valid keyword argument for asyncpg's
connect()method. Additionally,using
postgresql+psycopg2://prefix also fails because asyncpg requires an async driver.Suggested Fix
.env.examplethatsslmodemust not be included inPOSTGRES_CONNECTION_STRINGEnvironment
evoapicloud/evo-ai-processor-community:latestTypeError: connect() got an unexpected keyword argument 'sslmode'
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'psycopg2' is not async.
ValueError: Failed to create database engine for URL 'postgresql+psycopg2://postgres:***@evo-crm-postgres:5432/evo_community'
(psycopg2.errors.UndefinedTable) relation "sessions" does not exist
sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place?
Error searching for session b4a917bc-0fb6-43ed-9916-af0397d62dff: connect() got an unexpected keyword argument 'sslmode'
src.services.adk.runners.standard_runner - ERROR - Internal error processing request: 500: Error searching for session: connect() got an unexpected keyword argument 'sslmode'