Cory
Cory
Explore posts from servers
BABetter Auth
Created by Cory on 3/26/2025 in #help
Help handling JWT with Sveltekit
I am new to JWT but need them for a third-party API - what is the best practice to handle/cache them?
2 replies
BABetter Auth
Created by Cory on 3/5/2025 in #help
Is there a way to adjust the table names associated with plugins?
I see that you can adjust the table names defined for the core schema, but is the same possible with the available plugins?
1 replies
BABetter Auth
Created by Cory on 2/11/2025 in #bug-reports
Unable to generate cookie in "after" hooks for sign-in because un-authorized
I am trying to generate a JWT on sign in (although ideally I would need to update the JWT whenever the session changes), and when I do...
if (ctx.path === '/sign-in/email') {
if (ctx.request) {
const { token: jwt } = await auth.api.getToken({
headers: ctx.request.headers
});
ctx.setCookie('jwt', jwt, {
path: '/',
expires: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
secure: false
});
}
}
if (ctx.path === '/sign-in/email') {
if (ctx.request) {
const { token: jwt } = await auth.api.getToken({
headers: ctx.request.headers
});
ctx.setCookie('jwt', jwt, {
path: '/',
expires: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
secure: false
});
}
}
I am getting "un-authorized" because I guess the session technically has not been created yet at this point? Is there a better solution to this? I feel like I might going about this the wrong way - I don't have much experience with JWTs
1 replies
BABetter Auth
Created by Cory on 2/8/2025 in #bug-reports
Running SvelteKit on Cloudflare workers I am getting this error
[Better Auth]:\u001b[0m INTERNAL_SERVER_ERROR

Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be accessed from a different request's handler. This is a limitation of Cloudflare Workers which allows us to improve overall performance. (I/O type: Writable)
[Better Auth]:\u001b[0m INTERNAL_SERVER_ERROR

Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be accessed from a different request's handler. This is a limitation of Cloudflare Workers which allows us to improve overall performance. (I/O type: Writable)
via /api/auth/token inside onSuccess on sign-in
47 replies
BABetter Auth
Created by Cory on 1/30/2025 in #bug-reports
Is there a way to extend fields for plugins?
I see that you can extend database values with the user or session table, but are you able to do it with other tables created by plugins, such as organizations?
1 replies
DTDrizzle Team
Created by Cory on 1/17/2025 in #help
Place relations into seperate file?
When I put relations into it's own file such as relations.ts and also have schema.ts and then do...
import * as relations from '$lib/db/relations.js';
import * as schema from '$lib/db/schema.js';

export const db = drizzle({
...
schema: { ...schema, ...relations }
});
import * as relations from '$lib/db/relations.js';
import * as schema from '$lib/db/schema.js';

export const db = drizzle({
...
schema: { ...schema, ...relations }
});
it seems to be give me type issues
2 replies
BABetter Auth
Created by Cory on 1/15/2025 in #help
Downside to calling getSession() in SvelteKit hooks?
Would there be any waterfalling or downsides to utilizing getSession() in hooks.server.ts in SvelteKit, and then passing down Session and User to locals?
4 replies
BABetter Auth
Created by Cory on 1/14/2025 in #help
Best place to store user "settings"?
Is it bad practice to extend the user table with various settings? I want to add a default "org" so that org is always selected upon sign-in.
5 replies
BABetter Auth
Created by Cory on 1/9/2025 in #help
How to send verification code on signup hook
Is there a way to use a hook to send a email verification OTP upon signup?
2 replies
BABetter Auth
Created by Cory on 1/7/2025 in #help
Is it safe to implement organizations or will they be changing?
I know that nested orgranizations/workspaces were possibly going to be implemented. Is it safe to implement organizations as they are now, or should I wait till this feature is changed so I don't need to re-write?
1 replies
DTDrizzle Team
Created by Cory on 12/7/2024 in #help
Why does drizzle.config.ts have trouble recongizing my db url by not individual credentials?
When I use the url property to connect to my instance, I get an error saying it can't authorize the db user, but when I use the individual parameters such as, host, post, user, pass etc... it works. It's as if it's not reading the enviorment variable correct. Does anyone else have epxerience with the same issue and have found a solution to just using the url parameter?
1 replies
CDCloudflare Developers
Created by Cory on 10/23/2024 in #workers-help
Is there any way to have getPlatformProxy access remote data?
I want to use getPlatformProxy create a remote proxy so it uses actual data from my cf account instead of just mimmicking locally. Is it possible to do this?
1 replies
CDCloudflare Developers
Created by Cory on 10/19/2024 in #workers-help
Is it possible to use the Rate Limit API within an app created with Astro?
I am trying to use the new beta rate limit API in my application that is created using Astro. I understand how the runtime api and context works - but it seems to fail when trying to use the new Rate Limit API. Is there an example of this somewhere, or is it not possible?
1 replies
CDCloudflare Developers
Created by Cory on 4/12/2024 in #pages-help
How to enable unsafe binding in config
I am getting this error: Configuration file for Pages projects does not support "unsafe"
5 replies
CDCloudflare Developers
Created by Cory on 4/10/2024 in #pages-help
Support for separate wrangler.toml files in monorepo?
When using the new wrangler.toml support with Pages and new mono-repo support, Cloudflare seems to only look for the wrangler.toml file at the root directory (even if root directory is manually changed). I would like to have a seperate wrangler.toml for each Pages project within my mono-repo.
6 replies
CDCloudflare Developers
Created by Cory on 4/10/2024 in #general-help
How do I use multiple wrangler.toml with different projects in a mono-repo?
When I have my wrangler.toml in the directory of my app aka... apps/site/wrangler.toml It does not seem to know it's there. Putting it in the root directory of the project works - but I want to have seperate wrangler tomls for different projects - how can I do this?
10 replies
DTDrizzle Team
Created by Cory on 2/27/2024 in #help
isNotNull() returning incorrect Type
The following code...
export const getItemsInTrash = db
.select()
.from(schema.item)
.where(and(eq(schema.item.id, sql.placeholder('id')), isNotNull(schema.item.trashedAt)))
.orderBy(desc(schema.item.updatedAt))
.prepare();
export const getItemsInTrash = db
.select()
.from(schema.item)
.where(and(eq(schema.item.id, sql.placeholder('id')), isNotNull(schema.item.trashedAt)))
.orderBy(desc(schema.item.updatedAt))
.prepare();
Returns an array of objects where "trashedAt" is a Date | Null but this is not possible because I am using where isNotNull()
1 replies
CDCloudflare Developers
Created by Cory on 2/12/2024 in #workers-help
When running fetch to transform an image, it ignoring the "format" but only within my code
If I navigate to the URL directly, it formats it to webp, but if I use 'fetch' from within my sveltekit function, it doesn't convert it - is there a reason for this?
6 replies
DTDrizzle Team
Created by Cory on 2/8/2024 in #help
If I pass an object with a property that has 'undefined' as the value, will it be ignored?
If I am updating or inserting data and passing an object, for instance:
const dbData = {
id: undefined,
name: 'foo'
}
const dbData = {
id: undefined,
name: 'foo'
}
Will ID be ignored and not set?
3 replies
CDCloudflare Developers
Created by Cory on 2/1/2024 in #workers-help
Not image transforms not support transforming a AVIF image as the source?
Wondering whether I should accept AVIF image files, but it seems like it's not supported when trying to transform it
3 replies