Kalpak
Kalpak
Explore posts from servers
HHono
Created by Kalpak on 4/9/2025 in #help
zValidator c.req.valid("form") type error
Hey everyone, I am trying to use the zValidator middleware which I have setup in an auth.validator.ts file which looks like:
const signUpSchema = z.object({
email: z.string().email("Invalid email address"),
password: z
.string()
.regex(
passwordRegex,
"Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, and one number"
),
firstName: z.string().min(1, "First name is required"),
lastName: z.string().min(1, "Last name is required"),
// TODO: Add more specific validation for dob (date format) and gender (enum) if needed
dob: z
.string()
.regex(
dateRegex,
"Date must be in YYYY-MM-DD format with valid month and day"
),
gender: z.enum(["male", "female", "other"]),
});

// zValidator middleware instance for the sign-up form
const signUpValidator = zValidator("form", signUpSchema);
const signUpSchema = z.object({
email: z.string().email("Invalid email address"),
password: z
.string()
.regex(
passwordRegex,
"Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, and one number"
),
firstName: z.string().min(1, "First name is required"),
lastName: z.string().min(1, "Last name is required"),
// TODO: Add more specific validation for dob (date format) and gender (enum) if needed
dob: z
.string()
.regex(
dateRegex,
"Date must be in YYYY-MM-DD format with valid month and day"
),
gender: z.enum(["male", "female", "other"]),
});

// zValidator middleware instance for the sign-up form
const signUpValidator = zValidator("form", signUpSchema);
I have my route setup like:
app.post(
"/signup",
authValidator.signUpValidator,
signUpController.signUpWithEmail
);
app.post(
"/signup",
authValidator.signUpValidator,
signUpController.signUpWithEmail
);
and signUpController like:
async function signUpWithEmail(c: Context) {
// const { email, password, firstName, lastName, dob, gender } =
// await c.req.parseBody();

// const userMetadata = {
// first_name: firstName,
// last_name: lastName,
// dob,
// gender,
// };

const body = c.req.valid('form');
console.log(body);

// const { error } = await authService.signUpWithEmail(
// c,
// email as string,
// password as string,
// userMetadata as UserMetadata
// );

// if (error == null) {
// return c.render(<EmailVerificationCTA email={email as string} />);
// }

c.status(400);
return c.redirect("/auth/error");
}

export default { signUpWithEmail };
async function signUpWithEmail(c: Context) {
// const { email, password, firstName, lastName, dob, gender } =
// await c.req.parseBody();

// const userMetadata = {
// first_name: firstName,
// last_name: lastName,
// dob,
// gender,
// };

const body = c.req.valid('form');
console.log(body);

// const { error } = await authService.signUpWithEmail(
// c,
// email as string,
// password as string,
// userMetadata as UserMetadata
// );

// if (error == null) {
// return c.render(<EmailVerificationCTA email={email as string} />);
// }

c.status(400);
return c.redirect("/auth/error");
}

export default { signUpWithEmail };
When I am trying to use c.req.valid("form") i get the error: Argument of type '"form"' is not assignable to parameter of type 'never'. Im assuming its because the validator middleware is defined in and the route is setup in index.ts. how do I fix this? Do I have to type the Env being passed into the hono router created in index.ts? If so, how?
33 replies
RRunPod
Created by Kalpak on 2/22/2025 in #⚡|serverless
Help with deploying WhisperX ($35 bounty)
I've been trying to get WhisperX to run on runpod serverless. Here is what I have so far: https://github.com/YashGupta5961/whisperx-worker . The worker deploys but its running into some problems processing the request. I cant seem to debug whats going wrong. I am willing to offer $35 USD to anyone who can get it working with diarization. I know its not much but I hope it can be motivating to bang their head against the wall for me 😄
10 replies