felixdapony
felixdapony
TTCTheo's Typesafe Cult
Created by felixdapony on 5/30/2024 in #questions
Fetch from within trpc isnt working in vercel?
I found maybe one other guy that had this same problem but his fix was odd to me. Has anyone had this issue where if you do a post request from within a trpc router procedure, you get a content length mismatch? this happens only when deployed to vercel. weirdly enough (or not?) this works ok for GET requests...
protectedProcedure
.input(
z.object({
keys: z.array(z.array(z.string())),
}),
)
.mutation(async ({ input, ctx }) => {

const resp = await fetch(`${env.FASTAPI_ENDPOINT}/zip-files`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: superjson.stringify({ s3_keys: input.keys }),
});
protectedProcedure
.input(
z.object({
keys: z.array(z.array(z.string())),
}),
)
.mutation(async ({ input, ctx }) => {

const resp = await fetch(`${env.FASTAPI_ENDPOINT}/zip-files`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: superjson.stringify({ s3_keys: input.keys }),
});
2 replies