Connecting to CockroachDB serverless using pg via workers

  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?
Was this page helpful?