neoney
neoney2d ago

Get procedure path programatically?

Is it possible to get the path the procedure was called by programatically? I don't think it's possible to use anything like ctx.req.url when batching is enabled.
8 Replies
Alex / KATT 🐱
in what context do you need to do it? on the frontend?
neoney
neoneyOP2d ago
no, on the backend, i want to use the path for tracing
Alex / KATT 🐱
here's an example as a middleware: https://trpc.io/docs/server/middlewares#logging
neoney
neoneyOP2d ago
opts.path, yeah from testing stuff out i found that to exist but its not typed for some reason
neoney
neoneyOP2d ago
No description
Alex / KATT 🐱
it's available in middlewares, but apparently not in the resolver options
neoney
neoneyOP2d ago
but the value itself is there indeed huh that's weird i think i will resort to just manually checking if the value is there and the typeof... thank you
Alex / KATT 🐱
should be fairly easy to add it in the lib added in 11.5.0

Did you find this page helpful?