mihaaai
mihaaai
Explore posts from servers
BABetter Auth
Created by mihaaai on 3/30/2025 in #bug-reports
Can't generate migrations using D1 on Cloudflare Workers
The error happens just when trying to invoke the URL for the migration set within the app, returning a 500 and the error message on the server-side. auth() is using the getCloudflareContext() function from opennext to get the runtime environment to reference D1 in Kysely config.
export const auth = () =>
betterAuth({
database: {
db: new Kysely({
dialect: new D1Dialect({
database: getCloudflareContext().env.AUTH_DB,
}),
}),
type: "sqlite",
}
}
)
export const auth = () =>
betterAuth({
database: {
db: new Kysely({
dialect: new D1Dialect({
database: getCloudflareContext().env.AUTH_DB,
}),
}),
type: "sqlite",
}
}
)
5 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
I see, so there is some work to tune it up. Thanks for the tips, I totally forgot about hooks 👍
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
It's not indeed, I don't have a user for the invitation email to begin with, the flow would ideally look like: - I invite a user by email - The user goes to the link (unauthed) and accepts and only then creates an account to link, or right before accepting if not possible, it first create a user and then accepts - The user now has an account and is linked to the organization
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
It's not documented, but I kinda expect this method to return the whole data object with data about the inviter, organization, logo and so on, the same it gets to the sendInvitationEmail function
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
No description
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
const invitation: typeof $Infer.Invitation = await authService.api.getInvitation({
headers: event?.request.headers as Headers,
query: { id: invitationId } // invitationId being the form of `29LxWcj6PA0FLAWINePz7aezUrpOWV9r` in `pending` status in the invitation table of the DB
});
const invitation: typeof $Infer.Invitation = await authService.api.getInvitation({
headers: event?.request.headers as Headers,
query: { id: invitationId } // invitationId being the form of `29LxWcj6PA0FLAWINePz7aezUrpOWV9r` in `pending` status in the invitation table of the DB
});
This is behaving the same both when I'm logged in and where I'm logged out, ideally I'd need it to work without auth headers since the user won't have them by the time it reaches the page to accept the invitation. Same thing happens with the client-side method for getInvitation from within the app with an authed user, but it returns null instead of undefined
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
I see that hte backend api exposes the getInvitation method as well, but when trying to call it it always returns undefined, although I'm giving it an an argument the ID of a pending invitation, does this method only returns for accepted invitations?
31 replies
CDCloudflare Developers
Created by mihaaai on 1/27/2025 in #workers-help
Is it possible to use Cap'n Proto, to deserialize payloads instead of JSON, in Workers requests?
Awesome, this fixed problems with the older version! Thanks!
4 replies