ferdy
ferdy
Explore posts from servers
TtRPC
Created by ferdy on 7/19/2023 in #❓-help
trpc client request size limits?
I am sending a pretty sizable request and am seeing
[TRPCClientError: JSON Parse error: Unexpected token: <]
[TRPCClientError: JSON Parse error: Unexpected token: <]
I am not sure where the unexpected token is coming from or how to further debug this. My trpc client looks like
this.trpcClient = createTRPCProxyClient<TendrelAppRouter>({
links: [
loggerLink(
enabled: _ => true
}),
httpBatchLink({
url: stage.endpoint,
headers: () => ({ bearer: this.workerAuthToken }),
})
],
transformer: superjson
});
}
this.trpcClient = createTRPCProxyClient<TendrelAppRouter>({
links: [
loggerLink(
enabled: _ => true
}),
httpBatchLink({
url: stage.endpoint,
headers: () => ({ bearer: this.workerAuthToken }),
})
],
transformer: superjson
});
}
2 replies
TtRPC
Created by ferdy on 5/8/2023 in #❓-help
How to use createCaller() with lambda for testing?
Has anyone successfully mocked a trpc caller that uses the AWS Lambda integration? trying to write some unit tests
3 replies
TtRPC
Created by ferdy on 5/4/2023 in #❓-help
Get tRPC procedure latency?
Hi all, is there a supported mechanism to run common code to all procedures, say if I want to get latency metrics. I want to run the same latency math on all my procedures. I could create a helper function that I just have to remember to wrap all my procedure code in but just wondering if there's some supported tRPC way of doing this?
7 replies
TTCTheo's Typesafe Cult
Created by ferdy on 4/24/2023 in #questions
Nested keyof
Hi all, I am trying to use a fancy type to get a nested keyof effect. I found this code snippet online:
type NestedKeyOf<ObjectType extends object> = {
[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object
? `${Key}.${NestedKeyOf<ObjectType[Key]>}`
: `${Key}`;
}[keyof ObjectType & (string | number)];
type NestedKeyOf<ObjectType extends object> = {
[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object
? `${Key}.${NestedKeyOf<ObjectType[Key]>}`
: `${Key}`;
}[keyof ObjectType & (string | number)];
and when using it on the declaration side it definitely works, but I am having trouble using it to index into the type. here's a link to the code snippet: https://www.typescriptlang.org/play?#code/C4TwDgpgBAchDOwIBMDSEQHkBmAeTARgFYQDGwAKuNBAB5IB2y8UA9sWcAHxQC8UAbwBQUKAG10IKAEsGUANYZW2KIRLkqkKADIoACkQAnWQHMoAHygMArgFsCEQwEoAugC5VHDdQkYXUOkZmNi9gEVEoAH4oAAMAEgFJAF8AOgS4RBRJHHxQzQhfEBcuJJjw0Q94xIxSgG4hJLFFEGVPdUpqHX0jUwsrOwdnF3qhUC0AMVZWPkFyqAIAQ0MPYQi1+YWALw8ehhM5pIAaOewpneBjPYahIVJWBkQFDA8MpDQMHMnWHn4AIkXDClFptfiM7g9gFBTqwPF8ZqsIgCVsCPP8tr8jiczlBftDfg0oAsWODEGD7o9DAhrAAbSH8aFNPy1IA
2 replies
TtRPC
Created by ferdy on 3/6/2023 in #❓-help
trpc + AWS Lambda (through cdk)
Hi all, has anyone successfully integrated tRPC with AWS Lambda? My current stack is API Gateway + Lambda, all created through cdk. I am trying to figure out how to hook up the tRPC router and client to the lambda code. This is my first time using tRPC 😅
55 replies