MarvinKR
MarvinKR
Explore posts from servers
HHono
Created by MarvinKR on 6/21/2024 in #help
status 200 with empty JSON
But thanks for this idea! (Also I’m returning an array in this situation)
22 replies
HHono
Created by MarvinKR on 6/21/2024 in #help
status 200 with empty JSON
Yeah I’m not a big fan of the query api, prefer the native sql (that’s why I picked drizzle over prisma)
22 replies
HHono
Created by MarvinKR on 6/21/2024 in #help
status 200 with empty JSON
Thanks for picking that up! I did an inner join on the workflow table, you're right!
22 replies
HHono
Created by MarvinKR on 6/21/2024 in #help
status 200 with empty JSON
Found the issue I need 2x the same key "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY" & "CLERK_PUBLISHABLE_KEY" in a nextjs project
22 replies
HHono
Created by MarvinKR on 6/21/2024 in #help
status 200 with empty JSON
ok seems like there is an issue with the ClerkMiddleware() because I see unauthorized 401 when I remove it (and the console logs works too when I remove it
22 replies
HHono
Created by MarvinKR on 6/21/2024 in #help
status 200 with empty JSON
I added them but I don't see the console logs in my terminal?
22 replies
HHono
Created by MarvinKR on 6/21/2024 in #help
status 200 with empty JSON
But I'm using the Clerk middleware so since I'm not connected, the code should stop here & throw an error:
if (!auth?.userId) {
return c.json({ error: "Unauthorized" }, 401);
}
if (!auth?.userId) {
return c.json({ error: "Unauthorized" }, 401);
}
22 replies
HHono
Created by MarvinKR on 6/19/2024 in #help
All GET/POST api calls returns Internal server error 500
Thanks! Will check it out
10 replies
HHono
Created by MarvinKR on 6/19/2024 in #help
All GET/POST api calls returns Internal server error 500
so we can only use HTTPException for React Query onError to detect the error right?
10 replies
HHono
Created by MarvinKR on 6/19/2024 in #help
All GET/POST api calls returns Internal server error 500
I have the same issue with RPC + React Query like in https://discord.com/channels/1011308539819597844/1232536228226797589
10 replies
HHono
Created by igmtink on 4/24/2024 in #help
What is the best way to handle the error?
Did you manage to fix the matter? @igmtink I'm getting the error too when using RPC + React Query
22 replies
HHono
Created by MarvinKR on 6/19/2024 in #help
All GET/POST api calls returns Internal server error 500
when I don't use HTTPException in my routes but directly return c.json({ error: "Unauthorized" }, 401); I get this type issue in my RQ hook: type ResponseType = { error: string; } | { data: { name: string; id: number; description: string | null; createdAt: string | null; updatedAt: string; companyId: string | null; }; } RQ Hook:
import { InferRequestType, InferResponseType } from "hono";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";

import { client } from "@/lib/hono";

type ResponseType = InferResponseType<typeof client.api.workflows.$post>;
type RequestType = InferRequestType<typeof client.api.workflows.$post>["json"];

export const useCreateWorkflow = () => {
const queryClient = useQueryClient();
const mutation = useMutation<ResponseType, Error, RequestType>({
mutationFn: async (json) => {
const response = await client.api.workflows.$post({ json });
return await response.json();
},
onSuccess: () => {
toast.success("Workflow created successfully");
queryClient.invalidateQueries({ queryKey: ["workflows"] }); // refetch all workflows everytime we create a new workflow
},
onError: (error) => {
toast.error("Failed to create workflow");
},
});

return mutation;
};
import { InferRequestType, InferResponseType } from "hono";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";

import { client } from "@/lib/hono";

type ResponseType = InferResponseType<typeof client.api.workflows.$post>;
type RequestType = InferRequestType<typeof client.api.workflows.$post>["json"];

export const useCreateWorkflow = () => {
const queryClient = useQueryClient();
const mutation = useMutation<ResponseType, Error, RequestType>({
mutationFn: async (json) => {
const response = await client.api.workflows.$post({ json });
return await response.json();
},
onSuccess: () => {
toast.success("Workflow created successfully");
queryClient.invalidateQueries({ queryKey: ["workflows"] }); // refetch all workflows everytime we create a new workflow
},
onError: (error) => {
toast.error("Failed to create workflow");
},
});

return mutation;
};
10 replies
HHono
Created by MarvinKR on 6/19/2024 in #help
All GET/POST api calls returns Internal server error 500
No description
10 replies