What are the benefits of adding db to context rather than importing it directly in the router?
Calling Express `request.send` inside tRPC middleware/procedures
request.send
inside my tRPC middleware or procedures. I want to avoid rewriting our entire auth layer which is unfortunately deeply coupled with the express request/response objects, and instead just call our existing express middleware functions. However I want to make sure doing so isn't going to cause any memory leaks or hanging promises or anything which could silently brick the whole server.
Will the tRPC handler return or exit gracefully if the request is closed? Has anyone had experience with this?
example:...Extending "Meta" with downstream concat usage?
permission
and then requiring the meta data to extend the existing base Meta to contain a new required field e.g permission
In my attempts I've just been getting "meta mismatch"...following the trpc 11 guide on app router fails with dynamicIO on nextJS
Date.now()
instead of using performance
or without explicitly calling await connection()
beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time
at io (node_modules/next/src/server/node-environment-extensions/utils.tsx:33:31)
at now (node_modules/next/src/server/node-environment-extensions/date.tsx:17:9)...Fetch once and never again?
reactionTypes
once when my layout <MainLayout />
renders in Nextjs and never again because this data does not change. Currently, I have placed (what I think is) a headless component into my layout that accesses the query client then sets a staleTime: Infinity
default on this specific query.
Is this a dumb strategy? How might you do this differently?
```TSX...Unsafe assignment of an error typed value
Correct way to fetch trpc data on SSR and CSR
Client component does not receive updated data after refetch, how to resolve?
Can I respond to client from a middleware?
next()
as an output....Blob as response
Error handling abort on unstable_httpBatchStreamLink
nextjs middleware trpc authentication
new TRPCError({ code: 'UNAUTHORIZED' });
in the backend, how do I wrap that in nextjs middleware?
my nextjs middleware already reroutes to a 404 page if the requesting page is not found. how do I reroute to an authorized page for every server action with trpc?
in middleware.ts
it says that the request is getting captured at this location for some reason _nextjs_original-stack-frame
...Custom data transformer
LocalDate
, LocalTime
, Instant
, etc. from a date & time library. Every type can be serialized to a string (the corresponding ISO format) but it's unclear to me what the best strategy is via a data transformer?
Should I serialize these objects to a custom shape (e.g. { type: "LocalDate", value: "..." }
) so that it's trivial to deserialize? Seems kinda redundant since the type
information is already at the type level. Without a custom shape it's unclear to me how I would be able to deserialize the object given that I don't know the destination type....How to add req to Context?
ctx.req
and ctx.res
are always undefined. https://trpc.io/docs/server/context#inner-and-outer-context.
In this related issue, Julius stated that the code shouldn't even work. https://github.com/trpc/trpc/issues/5344.
What is the official consensus on this? If it doesn't work then how else does one add the request to context (and why is it in the docs)....Any guidance on adding middleware at the router level?
Sentry Profiling for TRPC
useQuery() integration is not passing `staleTime` to underlying query? (11.0.0-rc.593)
staleTime
on queries to something other than 0 to tell React Query that data loaded from storage is to be considered fresh. However, this doesn't work in practice if staleTime
is configured at the query level. I've managed to get persistence working correctly when configuring the query client's default options.
Is there an interaction that I'm not understanding here? Any advice would be welcome, thanks!...Getting CORS error with tRPC express adapter, locally
trpc version 11.0.0-rc.383 breaks turbo
How to use subscription with bullmq?