Skip to content

fix: normalize pg-boss sslmode to verify-full to silence deprecation warning #SUPERLOG - #439

Open
superlog-app[bot] wants to merge 1 commit into
mainfrom
superlog/fix-pgboss-ssl-verify-full
Open

fix: normalize pg-boss sslmode to verify-full to silence deprecation warning #SUPERLOG#439
superlog-app[bot] wants to merge 1 commit into
mainfrom
superlog/fix-pgboss-ssl-verify-full

Conversation

@superlog-app

@superlog-app superlog-app Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

On every cold-start, responder-control-plane (the Superlog API on Vercel) emits a Node.js process warning to stderr because pg-boss initializes with a DATABASE_URL containing sslmode=require. Vercel classifies all stderr output as ERROR severity, which opens a recurring noisy incident.

Root cause

pg-boss uses the pg package (pg@8.21.0) internally. When pg-boss parses the connection string via pg-connection-string@2.13.0, it emits a process.emitWarning if the sslmode value is require, prefer, or verify-ca. These modes are currently aliased to verify-full but will adopt weaker standard libpq semantics in pg-connection-string v3.0.0 / pg v9.0.0 (no server certificate verification).

Affected files:

  • apps/api/src/user-created-publisher.ts — pg-boss for user-created events (hit on the /api/auth/sign-up/email cold-start observed in the incident)
  • apps/worker/src/jobs/runner.ts — pg-boss for background job runner

Fix

Add a toVerifyFullSsl helper in each file that normalises the sslmode query param from require | prefer | verify-caverify-full before passing the connection string to PgBoss. This:

  1. Preserves the current (secure, verify-full) SSL behavior
  2. Makes the intent unambiguous in preparation for pg v9
  3. Eliminates the process warning and the resulting false-positive Vercel ERROR log

pgboss-migrate.ts already avoids this by using the env-var path (explicit ssl object option), so it is not affected.

Incident: d6b3bec2-d51c-479a-bd65-8a7ff95a82eb


Was this PR helpful? Leave feedback — goes straight to the Superlog team.


Summary by cubic

Normalize sslmode in DATABASE_URL to verify-full before initializing pg-boss to stop deprecation warnings and Vercel ERROR logs. Keeps strict TLS verification now and in pg v9.

  • Bug Fixes
    • Added toVerifyFullSsl() in apps/api/src/user-created-publisher.ts and apps/worker/src/jobs/runner.ts.
    • Maps require/prefer/verify-caverify-full before pg-connection-string runs.
    • Removes Node warning on cold starts in the API and worker while preserving verify-full behavior.

Written for commit dc4f64d. Summary will update on new commits.

Review in cubic

…warning #SUPERLOG

Delivery-Id: f08632815ca6594ef044e8b16d5a06ddcf24ee9451df0950f71d82ef9532de6d
Delivery-Base: main

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Observability review

  • 2 warnings

}
return url.toString();
} catch {
return connectionString;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

logs · warning — Log an error when DATABASE_URL cannot be parsed as a URL

Add an error-level log in the catch block so operators know the SSL normalization was skipped and pg-boss will receive the raw connection string; without it, a malformed DATABASE_URL silently bypasses the fix and the deprecation warning (or a future SSL regression) will reappear with no diagnostic trail.

Suggested change
return connectionString;
} catch (err) {
logger.error({ err }, "toVerifyFullSsl: failed to parse DATABASE_URL; using original connection string");
return connectionString;
}

Useful? React with 👍 / 👎.

url.searchParams.set("sslmode", "verify-full");
}
return url.toString();
} catch {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

logs · warning — Log an error when DATABASE_URL cannot be parsed as a URL in the worker

Add an error-level log in the catch block so operators know the SSL normalization was skipped in the worker; without it, a malformed DATABASE_URL silently bypasses the fix and the deprecation warning (or a future SSL regression) will reappear with no diagnostic trail.

Suggested change
} catch {
} catch (err) {
logger.error({ err }, "toVerifyFullSsl: failed to parse DATABASE_URL; using original connection string");
return connectionString;
}

Useful? React with 👍 / 👎.

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.

1 participant