-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Cannot access remote DB - BLOCKING network issue #28551
Comments
Additional info: |
Additional info:
|
After some trial and error, it appears that the dns/network is broken if you use an npm package with deno. This script works for all ways of importing: // import { Client } from https://deno.land/x/postgres@v0.19.3/mod.ts; // WORKS
import { Client } from "jsr:@bartlomieju/postgres"; // WORKS
const script_1 = `
SELECT
schema_name
FROM information_schema.schemata
WHERE
schema_name NOT in ('information_schema', 'hdb_catalog')
AND
NOT starts_with(schema_name, 'pg_')
AND
NOT starts_with(schema_name, 'fms_')
;
`;
console.log(script_1);
const client = new Client({
hostname: Deno.env.get("PGHOST"),
user: Deno.env.get("PGUSERNAME"),
password: Deno.env.get("PGPASSWORD"),
port: Deno.env.get("PGPORT"),
database: Deno.env.get("PGDATABASE"),
});
await client.connect();
{
const result = await client.queryObject(script_1);
console.log(result.rows);
}
await client.end();
console.log("END"); This script works does not work with npm import but works with denoland or jsr imports: // NOT OK -- error "Error: getaddrinfo ENOTFOUND"
// import postgres from "npm:postgres";
// OK run and types
// import postgres from https://deno.land/x/postgresjs@v3.4.5/mod.js;
// runs OK but types different from https://deno.land/x/postgresjs
// apparent lib issue bad export in lib deno.jsonc on jsr
import postgres from "@y0/postgres";
const certPath = Deno.env.get("REQUESTS_CA_BUNDLE");
const sql = postgres({
host: Deno.env.get("PGHOST") || "",
port: parseInt(Deno.env.get("PGPORT") || "3000"),
database: Deno.env.get("PGDATABASE") || "",
username: Deno.env.get("PGUSERNAME") || "",
password: Deno.env.get("PGPASSWORD") || "",
ssl: {
rejectUnauthorized: true,
ca: Deno.readTextFileSync(`${certPath}`).toString(),
},
});
const get_some_data = async () => {
const script = sql`
SELECT
schema_name
FROM information_schema.schemata
WHERE
schema_name NOT in ('information_schema', 'hdb_catalog')
AND
NOT starts_with(schema_name, 'pg_')
AND
NOT starts_with(schema_name, 'fms_')
;
`;
const query = sql`${script}`;
const data = await query;
return data;
};
const data = await get_some_data();
console.log({ data });
sql.end();
console.log("END"); So the current state is
Next question for postgres connection is: Which is best maintained ?
Compare this: with the package doc suggesting this import from denoland: Please advise ! |
It looks like this issue could have the "node compat" tag. |
Version: Deno
2.2.4
- latest as of writingI try to connect to a remote DB from an Redhat 8.x Linux VM - in a corp env (within LAN, no proxy involved).
This does not work in
deno
but works innode
andpython
- showing there is no credential or network problem.Possibly (loosely ?) related to #27803 and #27670 ?
Important Question
IS THERE AN IMMEDIATE WORKAROUND ?
THIS IS A PROBLEM FOR USE IN CORP ENV WHEN SUCH "BASIC" CAPABILITY FAILS - CASTS DOUBTS TO ABILITY TO USE IN PRODUCTION.
(caps to capture attention - hopefully).
Scripts
deno -> error
Output:
node -> works
python -> works
The text was updated successfully, but these errors were encountered: