I am using the docker compose file from here: https://neon.tech/guides/local-development-with-neon and SvelteKit/Drizzle. When I am making my connection using
```js
import { drizzle } from "drizzle-orm/neon-http";
import { neon } from "@neondatabase/serverless";
import { env } from "$env/dynamic/private";
if (!env.DATABASE_URL) throw new Error("DATABASE_URL is not set");
const client = neon(env.DATABASE_URL);
export const db = drizzle(client);
```
and call it using drizzle with
```js
const result = await db
.insert(users)
.values({
email: input.email,
subscriptionTier: "free",
fsrsWeights: default_w,
})
.returning();
```
I get the following error:
```
NeonDbError: Error connecting to database: fetch failed
at execute (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@neondatabase+serverless@0.9.5/node_modules/@neondatabase/serverless/index.mjs:1545:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async NeonHttpPreparedQuery.execute (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/drizzle-orm@0.33.0_@neondatabase+serverless@0.9.5_@types+pg@8.11.10_pg@8.13.1/node_modules/drizzle-orm/neon-http/session.js:32:20)
at async eval (/Users/joe/dev/llang/spacelang/src/lib/server/routes/users.ts:17:22)
at async resolveMiddleware (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:421:30)
at async callRecursive (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
at async callRecursive (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
at async resolve (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:481:24)
at async inputToProcedureCall (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/resolveHTTPResponse-2fc435bb.mjs:46:22)
at async Promise.all (index 0) {
severity: undefined,
code: undefined,
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: undefined,
line: undefined,
routine: undefined,
sourceError: TypeError: fetch failed
at node:internal/deps/undici/undici:12345:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async execute (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@neondatabase+serverless@0.9.5/node_modules/@neondatabase/serverless/index.mjs:1544:21)
at async NeonHttpPreparedQuery.execute (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/drizzle-orm@0.33.0_@neondatabase+serverless@0.9.5_@types+pg@8.11.10_pg@8.13.1/node_modules/drizzle-orm/neon-http/session.js:32:20)
at async eval (/Users/joe/dev/llang/spacelang/src/lib/server/routes/users.ts:17:22)
at async resolveMiddleware (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:421:30)
at async callRecursive (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
at async callRecursive (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:451:32)
at async resolve (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index.mjs:481:24)
at async inputToProcedureCall (file:///Users/joe/dev/llang/spacelang/node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/resolveHTTPResponse-2fc435bb.mjs:46:22) {
cause: Error: connect ECONNREFUSED 127.0.0.1:443
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 443
}
}
```
I am using the database url `DATABASE_URL="postgres://postgres:postgres@db.localtest.me:5432/main"` and it works when I use this python script:
```python
import os
from psycopg2 import pool
from dotenv import load_dotenv
# Load .env file
load_dotenv()
# Get the connection string from the environment variable
connection_string = 'postgres://postgres:postgres@db.localtest.me:5432/main'
# connection_string = 'postgres://postgres:postgres@postgres:5432/main'
# Create a connection pool
connection_pool = pool.SimpleConnectionPool(
1, # Minimum number of connections in the pool
10, # Maximum number of connections in the pool
connection_string
)
# Check if the pool was created successfully
if connection_pool:
print("Connection pool created successfully")
# Get a connection from the pool
conn = connection_pool.getconn()
# Create a cursor object
cur = conn.cursor()
# Execute SQL commands to retrieve the current time and version from PostgreSQL
cur.execute('SELECT NOW();')
time = cur.fetchone()[0]
cur.execute('SELECT version();')
version = cur.fetchone()[0]
# Close the cursor and return the connection to the pool
cur.close()
connection_pool.putconn(conn)
# Close all connections in the pool
connection_pool.closeall()
# Print the results
print('Current time:', time)
print('PostgreSQL version:', version)
```
what is the error?