Sebastian
Sebastian
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Sebastian on 1/4/2024 in #questions
Prisma turborepo deployment not initialized error
Having issues with the Prisma initializations only on deployments using Turborepo. Anyone encountered the same issues? Works locally, the client is generated as included in part of the build process, but on deployments, I get an error as it's not initialized in the web app.
13 replies
DTDrizzle Team
Created by Sebastian on 7/9/2023 in #help
Cannot drop index 'idx': needed in a foreign key constraint
So I had this table with its migration in the database:
export const userProfile = mysqlTable('user_profile', {
id: int("id").primaryKey().autoincrement()
userId: int('user_id'),
profilePicture: text('profile_picture').notNull(),
updatedAt: datetime('updated_at'),
bio: text('bio').notNull(),
age: int('age').notNull(),
}, (userProfile) => ({
userIdIndex: uniqueIndex("user_id_index").on(userProfile.userId)
}));
export const userProfile = mysqlTable('user_profile', {
id: int("id").primaryKey().autoincrement()
userId: int('user_id'),
profilePicture: text('profile_picture').notNull(),
updatedAt: datetime('updated_at'),
bio: text('bio').notNull(),
age: int('age').notNull(),
}, (userProfile) => ({
userIdIndex: uniqueIndex("user_id_index").on(userProfile.userId)
}));
Then modified it to the following: ( dropped id and made the userId the primaryKey )
export const userProfile = mysqlTable('user_profile', {
userId: int('user_id')
.primaryKey()
.references(() => users.id),,
profilePicture: text('profile_picture').notNull(),
updatedAt: datetime('updated_at'),
bio: text('bio').notNull(),
age: int('age').notNull(),
})
export const userProfile = mysqlTable('user_profile', {
userId: int('user_id')
.primaryKey()
.references(() => users.id),,
profilePicture: text('profile_picture').notNull(),
updatedAt: datetime('updated_at'),
bio: text('bio').notNull(),
age: int('age').notNull(),
})
When I'm trying to apply the migration, I get the error: "Cannot drop index 'user_id_idx': needed in a foreign key constraint" How can this type of thing be safely done? And is it a drizzle problem?
2 replies
TTCTheo's Typesafe Cult
Created by Sebastian on 6/23/2023 in #questions
Next auth in external services
Who knows how can we use NextAuth in external services? I want to manage authentication with NextAuth and run an authentication middleware in other microservices that are written in GO. Is it trivial?
1 replies
TTCTheo's Typesafe Cult
Created by Sebastian on 5/27/2023 in #questions
Neatly extract tRPC middleware to make it reusable
Does anybody have a snippet for neatly extracting a tRPC middleware, while also maintaining all the typesafety? I was able to hack something by importing MiddlewareFunction and extending a new interface from the ProcedureParams, imported from @trpc/server, omitting the _ctx_out and _input_out and replacing with mines, but it doesn't seem the right way.
3 replies
TTCTheo's Typesafe Cult
Created by Sebastian on 5/12/2023 in #questions
Next-Auth in server rendered components aka appDir pages
how do we deal with next-auth in appDir? I am genuinely curious, as I am trying to migrate from pages to app but using next-auth you have to wrap the app in the SessionProvider, which isn't ideal to do in the layout component, making all its children client components. So is there any nice solution yet?
4 replies
TTCTheo's Typesafe Cult
Created by Sebastian on 3/7/2023 in #questions
Sending additional info in the magic link auth token
Is it possible to pass additional data to the token that is sent for authentication via email magic links and when the email button is pressed and the signIn callback is called to also be able to process that token and that additional information that has been sent? And also for Google Oauth? #note: I am using database sessions
1 replies
TTCTheo's Typesafe Cult
Created by Sebastian on 2/10/2023 in #questions
Deployment error on vercel
9 replies