isitayush
isitayush
TtRPC
Created by hhhyh on 4/10/2023 in #❓-help
TRPCClientError - No "query"-procedure on path "user.all"
Aahah 😂, Should've done it before bothering here. I was almost out of breath since this thread is 2.9 months old. Thank you so much hhhyh!🫡
14 replies
TtRPC
Created by hhhyh on 4/10/2023 in #❓-help
TRPCClientError - No "query"-procedure on path "user.all"
Ah, It worked ^_^!! It was very strange though. I'm unsure what caused it.
14 replies
TtRPC
Created by hhhyh on 4/10/2023 in #❓-help
TRPCClientError - No "query"-procedure on path "user.all"
Trying it. rm rf the modules and .next and restart the dev server! A moment.
14 replies
TtRPC
Created by hhhyh on 4/10/2023 in #❓-help
TRPCClientError - No "query"-procedure on path "user.all"
T3!
14 replies
TtRPC
Created by hhhyh on 4/10/2023 in #❓-help
TRPCClientError - No "query"-procedure on path "user.all"
Similar error, TRPCClientError: No "query"-procedure on path "myRouter.procedure". It worked fine when I added it for the first time although I'm not sure what change I made that caused it to error like that. Other procedures work fine and autocomplete seems to recognize this procedure although it errors out on console. I didn't make any change that could induce such an error. Even verified via git status.
14 replies
TtRPC
Created by hhhyh on 4/10/2023 in #❓-help
TRPCClientError - No "query"-procedure on path "user.all"
Hey @hhhyh, I know this is late but what was the issue? I've encountered a similar issue so hope I find something here.
14 replies
TtRPC
Created by isitayush on 2/17/2023 in #❓-help
typesafe permissions
thanks alex! both this & nick's solution works great.
28 replies
TtRPC
Created by isitayush on 2/17/2023 in #❓-help
typesafe permissions
Understood! Thank You. I'll try this & if it works I'll update it here & let you know.
28 replies
TtRPC
Created by isitayush on 2/17/2023 in #❓-help
typesafe permissions
If I'm not wrong Nick, The meta can be accessed in the middleware before a procedure is fired right?
28 replies
TtRPC
Created by isitayush on 2/17/2023 in #❓-help
typesafe permissions
I'm not sure though what ["_def"]["record"] really hold here.
28 replies
TtRPC
Created by isitayush on 2/17/2023 in #❓-help
typesafe permissions
Diving in some internal code for trpc (the GetInferenceHelpers to be more precise). I did find my self a working solution.
type MapRouterToPermissions<T extends AnyRouter> = {
[K in keyof T["_def"]["record"]]: T["_def"]["record"][K] extends infer P
? P extends AnyRouter
? MapRouterToPermissions<P>
: P extends AnyProcedure
? string[]
: never
: never;
};
type MapRouterToPermissions<T extends AnyRouter> = {
[K in keyof T["_def"]["record"]]: T["_def"]["record"][K] extends infer P
? P extends AnyRouter
? MapRouterToPermissions<P>
: P extends AnyProcedure
? string[]
: never
: never;
};
28 replies
TtRPC
Created by isitayush on 2/17/2023 in #❓-help
typesafe permissions
Apologizes for this late response. You're right. It'd be nicer if I could achieve this with Meta. However, I am not really sure how that would work. I tried creating a solution using Meta but couldn't really come up with something that would fit my case.
28 replies
TtRPC
Created by isitayush on 2/14/2023 in #❓-help
awaiting for procedure & logging the response.
Update: Is it possible to ensure that every procedure returns a defined type of data? Something similar to .output() but in a way where I don't need to define it again & again for every procedure.
3 replies
TtRPC
Created by isitayush on 2/14/2023 in #❓-help
awaiting for procedure & logging the response.
tldr; Is it possible for my procedure to act as a middlware & my post middlware as a response? If I'm missing something or if someone has a better approach. I'll greatly appreciate it.
3 replies