Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working at all #9

Closed
khanakia opened this issue Mar 14, 2025 · 1 comment
Closed

Not working at all #9

khanakia opened this issue Mar 14, 2025 · 1 comment

Comments

@khanakia
Copy link

followed this half baked tutorial https://sdk.vercel.ai/docs/guides/natural-language-postgres#explain-sql-queries
and getting the below error
.env

OPENAI_API_KEY="your_api_key_here"
POSTGRES_URL="postgresql://postgres:[email protected]:5432/ai_vercel_postgresdb?sslmode=require"
POSTGRES_PRISMA_URL="postgresql://postgres:[email protected]:5432/ai_vercel_postgresdb?sslmode=require"
POSTGRES_URL_NO_SSL="postgresql://postgres:[email protected]:5432/ai_vercel_postgresdb?sslmode=require"
POSTGRES_URL_NON_POOLING="postgresql://postgres:[email protected]:5432/ai_vercel_postgresdb?sslmode=require"
POSTGRES_USER="postgres"
POSTGRES_HOST="127.0.0.1"
POSTGRES_PASSWORD="postgres"
POSTGRES_DATABASE="ai_vercel_postgresdb"
➜  natural-language-postgres git:(live) pnpm run seed


> [email protected] seed /Volumes/D/khanakia/Downloads/natural-language-postgres
> tsx lib/seed.ts

VercelPostgresError: VercelPostgresError - 'invalid_connection_string': This connection string is meant to be used with a direct connection. Make sure to use a pooled connection string or try `createClient()` instead.
    at createPool (/Volumes/D/khanakia/Downloads/natural-language-postgres/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vercel/postgres/src/create-pool.ts:95:11)
    at Object.apply (/Volumes/D/khanakia/Downloads/natural-language-postgres/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vercel/postgres/src/index.ts:39:16)
    at seed (/Volumes/D/khanakia/Downloads/natural-language-postgres/lib/seed.ts:20:29)
    at csv (/Volumes/D/khanakia/Downloads/natural-language-postgres/lib/seed.ts:73:1)
    at Object.<anonymous> (/Volumes/D/khanakia/Downloads/natural-language-postgres/lib/seed.ts:73:27)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Object.transformer (/Volumes/D/khanakia/Downloads/natural-language-postgres/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/register-DCnOAxY2.cjs:2:1186)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
    at Function._load (node:internal/modules/cjs/loader:1128:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14) {
  code: 'invalid_connection_string'
}
@nicoalbanese
Copy link
Contributor

Did you include ?sslmode=require at the end of your connection string?

@khanakia khanakia closed this as completed Apr 3, 2025
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

No branches or pull requests

2 participants