sanner
sanner
Explore posts from servers
BblendOS
Created by sanner on 11/2/2024 in #🆘┃support
ssh into podman containers blendos
I was trying to some of the blendos arch podman containers with vscode and I was wondering how to setup ssh on the podman containers to be able to remote into the container
8 replies
CDCloudflare Developers
Created by sanner on 9/2/2024 in #workers-help
knex+workers TypeError
I was working with Cloudflare Workers + bun & Hono and was using Knex as my orm. I was successfully ably to make a connection on Cloudlfare Pages to Knex+Postgres with Connection Pooling however on Workers I am recieving a TypeErorr. I tried using both the connectionString and specifiying the individual parameters for the database. Additionally I set node_compat = true and also added the
node:
node:
prefix previously when using compatibility_flags = ["nodejs_compat"] I also played around with the version numbers of both the sql connection adapter
pg
pg
and
Error:
Error:
javascript [wrangler:err] TypeError: this.driver.Client is not a constructor at Client_PG._acquireOnlyConnection (file:///home/sanner/Coding/Anemo/auth.ran.so/node_modules/knex/lib/dialects/postgres/index.js:81:24) at Client_PG.acquireRawConnection (file:///home/sanner/Coding/Anemo/auth.ran.so/node_modules/knex/lib/dialects/postgres/index.js:99:17) at create (file:///home/sanner/Coding/Anemo/auth.ran.so/node_modules/knex/lib/client.js:262:39)
Error Source:
Error Source:
javascript knex({ client: 'pg', // Replace 'pg' with your database client if different connection: { host: "hostDB", port: 5432, user: "postgres", password: "passwordDB", database: "databaseName", ssl: { rejectUnauthorized: false, }, }, searchPath: ['knex', 'public'], // Optional: Specify search path for PostgreSQL }); ```
1 replies
HHono
Created by sanner on 9/2/2024 in #help
Knex + Hono + Bun Connection Errors
I was using knex on bun+hono and was attempting to make a connection via the following syntax
import { Knex, knex } from 'knex';
import pg from 'pg';

const client = knex({
client: 'pg', // Replace 'pg' with your database client if different
connection: {
host: "hostDB",
port: 5432,
user: "postgres",
password: "passwordDB",
database: "databaseName",
ssl: {
rejectUnauthorized: false,
},
},
searchPath: ['knex', 'public'], // Optional: Specify search path for PostgreSQL
});
import { Knex, knex } from 'knex';
import pg from 'pg';

const client = knex({
client: 'pg', // Replace 'pg' with your database client if different
connection: {
host: "hostDB",
port: 5432,
user: "postgres",
password: "passwordDB",
database: "databaseName",
ssl: {
rejectUnauthorized: false,
},
},
searchPath: ['knex', 'public'], // Optional: Specify search path for PostgreSQL
});
and i was getting the following error
TypeError: this.driver.Client is not a constructor
at Client_PG._acquireOnlyConnection (file:///home/sanner/Coding/node_modules/knex/lib/dialects/postgres/index.js:83:24)
at Client_PG.acquireRawConnection (file:///home/sanner/Coding//node_modules/knex/lib/dialects/postgres/index.js:101:17)
at create (file:///home/
/node_modules/knex/lib/client.js:262:39)
TypeError: this.driver.Client is not a constructor
at Client_PG._acquireOnlyConnection (file:///home/sanner/Coding/node_modules/knex/lib/dialects/postgres/index.js:83:24)
at Client_PG.acquireRawConnection (file:///home/sanner/Coding//node_modules/knex/lib/dialects/postgres/index.js:101:17)
at create (file:///home/
/node_modules/knex/lib/client.js:262:39)
I was trying to connect to Knex with a postgres client however I am getting this error, I tried many things such as creating a client and adding that to client. This code was able to work on a pnpm worker with nodejs, however it does not work with bun+hono
2 replies
CDCloudflare Developers
Created by sanner on 8/27/2024 in #pages-help
OATUH Cloudflare Pages
I was developing trying to implement github oauth on cloudfare pages using a beta branch. the production branch is define as another branch and the production branch contains the main url. It works locally but not on cloudflare pages my oauth flow looks like this at the moment
export async function GET(context: APIContext): Promise<Response> {
const state = generateState();
const url = await github.createAuthorizationURL(state);

context.cookies.set("github_oauth_state", state, {
path: "/",
secure: DEPLOYED_ENV,
httpOnly: true,
maxAge: 60 * 10,
sameSite: "lax"
});

const responseBody = {
url: url.toString()
};
const response = new Response(JSON.stringify(responseBody), {
status: 200,
headers: {
"content-type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "*"
}
});
return response;
}
export async function GET(context: APIContext): Promise<Response> {
const state = generateState();
const url = await github.createAuthorizationURL(state);

context.cookies.set("github_oauth_state", state, {
path: "/",
secure: DEPLOYED_ENV,
httpOnly: true,
maxAge: 60 * 10,
sameSite: "lax"
});

const responseBody = {
url: url.toString()
};
const response = new Response(JSON.stringify(responseBody), {
status: 200,
headers: {
"content-type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "*"
}
});
return response;
}
25 replies
CDCloudflare Developers
Created by sanner on 8/27/2024 in #general-help
Cloudflare Pages Oauth (Google/Github)
I was developing trying to implement github oauth on cloudfare pages using a beta branch. the production branch is define as another branch and the production branch contains the main url. It works locally but not on cloudflare pages my oauth flow looks like this at the moment
export async function GET(context: APIContext): Promise<Response> {
const state = generateState();
const url = await github.createAuthorizationURL(state);

context.cookies.set("github_oauth_state", state, {
path: "/",
secure: DEPLOYED_ENV,
httpOnly: true,
maxAge: 60 * 10,
sameSite: "lax"
});

const responseBody = {
url: url.toString()
};
const response = new Response(JSON.stringify(responseBody), {
status: 200,
headers: {
"content-type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "*"
}
});
return response;
}
export async function GET(context: APIContext): Promise<Response> {
const state = generateState();
const url = await github.createAuthorizationURL(state);

context.cookies.set("github_oauth_state", state, {
path: "/",
secure: DEPLOYED_ENV,
httpOnly: true,
maxAge: 60 * 10,
sameSite: "lax"
});

const responseBody = {
url: url.toString()
};
const response = new Response(JSON.stringify(responseBody), {
status: 200,
headers: {
"content-type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "*"
}
});
return response;
}
3 replies
DTDrizzle Team
Created by sanner on 8/18/2024 in #help
Migration Halts
No description
7 replies