Matan Nahmani
Matan Nahmani
Explore posts from servers
DTDrizzle Team
Created by Matan Nahmani on 10/24/2023 in #help
is there a way to wrap a column select with ST_AsText or any other sql statement?
I've created a custom column type but the column return by default a binary data, instead i want to wrap the select automatically with ST_AsText to human readable text.
10 replies
TtRPC
Created by Matan Nahmani on 10/13/2023 in #❓-help
calling TRPCProxyClient from inside trpc procedure fails on vercel route handlers edge runtime
i setup my client as following:
export const serverToServerApi = createTRPCProxyClient<AppRouter>({
transformer,
links: [
httpLink({
url: getUrl(),
fetch: async (input, init) => {
console.log("fetch", input, init);
const res = await fetch(input, init);
console.log("RES", res);
return fetch(input, init);
},
headers() {
return {
"x-trpc-source": "server",
Authorization: `Bearer ${env.SERVER_API_KEY}`,
};
},
}),
],
});
export const serverToServerApi = createTRPCProxyClient<AppRouter>({
transformer,
links: [
httpLink({
url: getUrl(),
fetch: async (input, init) => {
console.log("fetch", input, init);
const res = await fetch(input, init);
console.log("RES", res);
return fetch(input, init);
},
headers() {
return {
"x-trpc-source": "server",
Authorization: `Bearer ${env.SERVER_API_KEY}`,
};
},
}),
],
});
and then inside a trpc procedure i'm trying to call it as following:
void serverToServerApi.ai.newMembers.mutate({
roomId: room.id,
preferenceIds: [insertResult[0].id],
});
void serverToServerApi.ai.newMembers.mutate({
roomId: room.id,
preferenceIds: [insertResult[0].id],
});
this result in request always failing with an error of:
TRPCClientError: Unexpected end of JSON input
TRPCClientError: Unexpected end of JSON input
any ideas how to solve this?
2 replies
DTDrizzle Team
Created by Matan Nahmani on 10/3/2023 in #help
createInsertSchema forgets .$type() on text json mode fields in sqlite
for example: foodThemes: text("foodThemes", { mode: "json", }).$type<foodThemes[]>(), foodThemes will be referenced as JSON
2 replies