Skip to content

fix(postgres): Support TLS and query params in pg_url#565

Open
moleus wants to merge 2 commits intogetsentry:mainfrom
moleus:fix-support-pg-tls-and-parse-url-queries
Open

fix(postgres): Support TLS and query params in pg_url#565
moleus wants to merge 2 commits intogetsentry:mainfrom
moleus:fix-support-pg-tls-and-parse-url-queries

Conversation

@moleus
Copy link

@moleus moleus commented Mar 4, 2026

I tried to use taskbroker with AWS RDS Postgres as a storage.

First, i got an error when tried to use it with DB_URL=<host>?sslmode=require:

taskbroker starting
version: 0d30342f0caad2e7cd1767518e526bc19175b461
Error: error returned from database: no pg_hba.conf entry for host "10.xxx.xxx.xx", user "xxxxx", database "sslmode=require/postgres", no encryption

Caused by:
    no pg_hba.conf entry for host "10.xxx.xxx.xx", user "xxxx", database "sslmode=require/postgres", no encryption
stream closed: EOF for sentry/sentry-taskbroker-bb95569fb-f6d8l (sentry-taskbroker)

I realised, that there is simple concatenation let conn_str = url.to_owned() + "/" + database_name;.

So <host>?sslmode=require and db_name becomes <host>?sslmode=require/postgres

Then I set TASKBROKER_PG_DATABASE_NAME=sentry?sslmode=require and got error:

taskbroker starting
version: 0d30342f0caad2e7cd1767518e526bc19175b461
Error: error occurred while attempting to establish a TLS connection: TLS upgrade required by connect options but SQLx was built without TLS support enabled

Caused by:
    TLS upgrade required by connect options but SQLx was built without TLS support enabled
stream closed: EOF for sentry/sentry-taskbroker-6f7cbd98c7-cxp2s (sentry-taskbroker)

This PR adds TLS feature for sqlx lib. And fixes conn opts construction - parse url with queries into options first and then add database field

@markstory
Copy link
Member

I tried to use taskbroker with AWS RDS Postgres as a storage.

Be aware that this support is still experimental and subject to change. I would not recommend using it in production yet.

Copy link
Member

@evanh evanh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a test for this? Otherwise it's a solid change.

@moleus
Copy link
Author

moleus commented Mar 5, 2026

Added tests. Unsure of the standard style, so I put them next to the source function.

@moleus moleus marked this pull request as ready for review March 5, 2026 09:42
@moleus moleus requested a review from a team as a code owner March 5, 2026 09:42
@moleus
Copy link
Author

moleus commented Mar 5, 2026

Be aware that this support is still experimental and subject to change. I would not recommend using it in production yet.

Are there any production ready alternatives in Self-hosted Sentry for task processing other than taskbroker? As far as I can see Celery is gradually removed from sentry source code and taskworkers are enabled by default - getsentry/sentry#99374

@moleus
Copy link
Author

moleus commented Mar 6, 2026

Be aware that this support is still experimental and subject to change. I would not recommend using it in production yet.

Are there any production ready alternatives in Self-hosted Sentry for task processing other than taskbroker? As far as I can see Celery is gradually removed from sentry source code and taskworkers are enabled by default - getsentry/sentry#99374

Oh, sorry, do you mean support of RDS in taskbroker? Then it totally makes sense 🙏

@markstory
Copy link
Member

Oh, sorry, do you mean support of RDS in taskbroker? Then it totally makes sense

Yes, only the postgres drive is the experimental part. Taskbroker also has a sqlite storage adapter that is fully supported right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants