Foxikira
Foxikira
Explore posts from servers
DTDrizzle Team
Created by Foxikira on 2/7/2024 in #help
Interface for both db and tx
I am trying to create some utility functions that would accept both DB and transaction. I tried the following
export type DBRelation = ExtractTablesWithRelations<typeof schema>;
export type DBTransaction = PgTransaction<PostgresJsQueryResultHKT, typeof schema, DbRelation>;
export type DBRelation = ExtractTablesWithRelations<typeof schema>;
export type DBTransaction = PgTransaction<PostgresJsQueryResultHKT, typeof schema, DbRelation>;
trying to pass my db type to it results in error (passing tx works) here is how my query function looks like
type TokenUser = Token & { user: Omit<User, "passwordHash"> };
export async function getToken<DB extends DBTransaction>(tx: DB, token: string, tokenType: TokenType): Promise<TokenUser | undefined> {
return await tx.query.tokens.findFirst({
where: and(
eq(tokens.token, token),
isNull(tokens.disabledAt),
gt(tokens.expiresAt, new Date()),
eq(tokens.tokenType, tokenType)
),
with: {
user: {
columns: {
passwordHash: false,
}
}
}
});
}
type TokenUser = Token & { user: Omit<User, "passwordHash"> };
export async function getToken<DB extends DBTransaction>(tx: DB, token: string, tokenType: TokenType): Promise<TokenUser | undefined> {
return await tx.query.tokens.findFirst({
where: and(
eq(tokens.token, token),
isNull(tokens.disabledAt),
gt(tokens.expiresAt, new Date()),
eq(tokens.tokenType, tokenType)
),
with: {
user: {
columns: {
passwordHash: false,
}
}
}
});
}
how can i fix this
2 replies
CDCloudflare Developers
Created by Foxikira on 8/14/2023 in #pages-help
Getting Internal Server Error while deploying a nextjs application
13:20:12.860 Failed: an internal error occurred
13:20:12.860 Error: Failed to publish assets. For support, join our Discord (https://discord.gg/cloudflaredev) or create a ticket and reference the deployment ID: 66888a5a-921b-41c0-83e5-9993d50a6acc
13:20:12.860 Failed: an internal error occurred
13:20:12.860 Error: Failed to publish assets. For support, join our Discord (https://discord.gg/cloudflaredev) or create a ticket and reference the deployment ID: 66888a5a-921b-41c0-83e5-9993d50a6acc
There is no additional error message the log message before this says
13:20:08.053 ✨ Compiled Worker successfully
13:20:08.142 Found _routes.json in output directory. Uploading.
13:20:08.161 Validating asset output directory
13:20:08.053 ✨ Compiled Worker successfully
13:20:08.142 Found _routes.json in output directory. Uploading.
13:20:08.161 Validating asset output directory
It does not seem to be nextjs related. My nextjs version is 13.4.13 Unfortunately the code is not open source
21 replies