mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
fix: remove duplicate neon pooler (#990)
## Description Fixes the issue with Vercel preview deployments failing. It appears that the old `PGHOST` environment variable injected by neon was: `ep-snowy-snowflake-a2vc5pa2.eu-central-1.aws.neon.tech` It is now: `ep-snowy-snowflake-a2vc5pa2.eu-central-1-pooler.aws.neon.tech` Notice the `-pooler` being attached automatically to the `PGHOST`. ## References > The following changes were made to the [Neon Vercel Integration](https://vercel.com/integrations/neon): > >To ensure that users accessing a Neon database from a serverless environment have enough connections, the DATABASE_URL and PGHOST environment variables added to a Vercel project by the Neon integration are now set to a pooled Neon connection string by default. Pooled connections support up to 10,000 simultaneous connections. Previously, these variables were set to an unpooled connection string supporting fewer concurrent connections. https://neon.tech/docs/changelog https://neon.tech/docs/guides/vercel#manage-vercel-environment-variables
This commit is contained in:
@ -6,7 +6,6 @@ set -eo pipefail
|
||||
# Get the directory of this script, regardless of where it is called from.
|
||||
SCRIPT_DIR="$(readlink -f "$(dirname "$0")")"
|
||||
|
||||
|
||||
function log() {
|
||||
echo "[VercelBuild]: $1"
|
||||
}
|
||||
@ -69,19 +68,17 @@ function remap_database_integration() {
|
||||
export NEXT_PRIVATE_DIRECT_DATABASE_URL="$DATABASE_URL"
|
||||
fi
|
||||
|
||||
if [[ ! -z "$DATABASE_URL_UNPOOLED" ]]; then
|
||||
log "Remapping for Neon integration"
|
||||
|
||||
export NEXT_PRIVATE_DATABASE_URL="$DATABASE_URL&pgbouncer=true"
|
||||
export NEXT_PRIVATE_DIRECT_DATABASE_URL="$DATABASE_URL_UNPOOLED"
|
||||
fi
|
||||
|
||||
if [[ ! -z "$POSTGRES_URL_NON_POOLING" ]]; then
|
||||
export NEXT_PRIVATE_DATABASE_URL="$POSTGRES_URL?pgbouncer=true"
|
||||
export NEXT_PRIVATE_DIRECT_DATABASE_URL="$POSTGRES_URL_NON_POOLING"
|
||||
fi
|
||||
|
||||
if [[ "$NEXT_PRIVATE_DATABASE_URL" == *"neon.tech"* ]]; then
|
||||
log "Remapping for Neon integration"
|
||||
|
||||
PROJECT_ID="$(echo "$PGHOST" | cut -d'.' -f1)"
|
||||
PGBOUNCER_HOST="$(echo "$PGHOST" | sed "s/${PROJECT_ID}/${PROJECT_ID}-pooler/")"
|
||||
|
||||
export NEXT_PRIVATE_DATABASE_URL="postgres://${PGUSER}:${PGPASSWORD}@${PGBOUNCER_HOST}/${PGDATABASE}?pgbouncer=true"
|
||||
fi
|
||||
}
|
||||
|
||||
# Navigate to the root of the project.
|
||||
|
||||
Reference in New Issue
Block a user