๐Ÿ› BUG: Uncaught exception ยท Issue #1401...

For some weird reason I get [Error: internal error] with postgresjs on local development. It comes from the net.socket connection, and there is no useful other info in the error unfortunately. Wondering if its related to https://github.com/cloudflare/workerd/issues/1401
GitHub
๐Ÿ› BUG: Uncaught exception ยท Issue #1401 ยท cloudflare/workerd
Which Cloudflare product(s) does this pertain to? Wrangler or miniflare What version(s) of the tool(s) are you using? 3.5.0 What version of Node are you using? 18.16.1 What operating system are you...
1 Reply
quambo
quamboOPโ€ข10mo ago
Here is my full code https://discord.com/channels/595317990191398933/1150557986239021106/1205884453101113414 I just can't get it to work ๐Ÿ˜ฆ trying postgres package, also no success, error
[wrangler:err] Error: internal error
at cachedError (/x/node_modules/postgres/cf/src/query.js:170:23)
at new Query (/x/node_modules/postgres/cf/src/query.js:36:24)
at sql2 (/x/node_modules/postgres/cf/src/index.js:113:11)
at Object.fetch (/x/index.ts:9:23)
[wrangler:err] Error: internal error
at cachedError (/x/node_modules/postgres/cf/src/query.js:170:23)
at new Query (/x/node_modules/postgres/cf/src/query.js:36:24)
at sql2 (/x/node_modules/postgres/cf/src/index.js:113:11)
at Object.fetch (/x/index.ts:9:23)
index.ts
import postgres from 'postgres';

export default {
async fetch(request: Request, env: any) {
const connectionString =
env.DATABASE_URL || env.HYPERDRIVE.connectionString;
console.log('fetch', request.url, env.DATABASE_URL);
const sql = postgres(connectionString);
const abc = await sql`SELECT * FROM tenant LIMIT 10`;
console.log('abc', abc);

return new Response(JSON.stringify({ ok: true }));
},
};
import postgres from 'postgres';

export default {
async fetch(request: Request, env: any) {
const connectionString =
env.DATABASE_URL || env.HYPERDRIVE.connectionString;
console.log('fetch', request.url, env.DATABASE_URL);
const sql = postgres(connectionString);
const abc = await sql`SELECT * FROM tenant LIMIT 10`;
console.log('abc', abc);

return new Response(JSON.stringify({ ok: true }));
},
};
package.json
{
"name": "x",
"dependencies": {
"postgres": "^3.4.3"
}
}
{
"name": "x",
"dependencies": {
"postgres": "^3.4.3"
}
}
wrangler.toml
name = "xyz"
compatibility_flags = ["nodejs_compat"]
name = "xyz"
compatibility_flags = ["nodejs_compat"]
Anyone knows what could be wrong here? its really only with local dev
Want results from more Discord servers?
Add your server