Connecting to CockroachDB serverless using pg via ...
# workers-help
b
1. Created a npx wrangler init . 2. Then "npm install pg" and added the query code into index.js 3. then, npx wrangler dev, got compatibility errors, and got suggestions to add "node_compat = true", and I did, those errors disappeared 4. Then again ran "npx wrangler dev", got error ' **could not resolve "pg-native**" '. And this is where I'm struck. I ran same code in normal js and it worked, but I don't know why is it asking "pg-native", and also I tried to install it locally and globally, and it won't get installed. 5. What to do?
s
PG will need TCP connections which aren't yet available in workers
There's been lots of work around TCP in the runtime's repo, so hopefully we'll see something coming out soon!
b
any other immediate solution?
s
If you can connect to the database over http(s), that'll work
Some examples are planetscale, supabase, neon, etc.