T
tRPC

Showing pending inside the request?

Showing pending inside the request?

Aacronie9/20/2023
I am using trpc with nextjs but when I am using hooks they're just not returning anything? Like it makes the request but it goes as pending and just blocks everything
Aacronie9/20/2023
No description
Aacronie9/20/2023
const { data: news } = api.news.getAllNews.useQuery(); I noticed this seems to be happening with the hooks only Because I am using server side calls in some places by creating a caller
Aacronie9/20/2023
query logs
No description
Aacronie9/20/2023
"@trpc/client": "^10.38.3",
"@trpc/next": "^10.38.3",
"@trpc/react-query": "^10.38.3",

"@trpc/client": "^10.38.3",
"@trpc/next": "^10.38.3",
"@trpc/react-query": "^10.38.3",

"next": "13.4.12", and next version
- wait compiling /api/trpc/[trpc] (client and server)...
- event compiled successfully in 605 ms (142 modules)
- wait compiling /api/trpc/[trpc] (client and server)...
- event compiled successfully in 605 ms (142 modules)
the trpc server seems to be compiling
import { createNextApiHandler } from "@trpc/server/adapters/next";
import { withIronSessionApiRoute } from "iron-session/next";
import { env } from "@/env.mjs";
import { appRouter } from "@/server/api/root";
import { createTRPCContext } from "@/server/api/trpc";
import { NextApiRequest, NextApiResponse } from "next";
import { sessionOptions } from "@/utils/session";

const handler = (req: NextApiRequest, res: NextApiResponse) => {
return createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`,
);
}
: undefined,
})(req, res);
};
export default withIronSessionApiRoute(handler, sessionOptions);
import { createNextApiHandler } from "@trpc/server/adapters/next";
import { withIronSessionApiRoute } from "iron-session/next";
import { env } from "@/env.mjs";
import { appRouter } from "@/server/api/root";
import { createTRPCContext } from "@/server/api/trpc";
import { NextApiRequest, NextApiResponse } from "next";
import { sessionOptions } from "@/utils/session";

const handler = (req: NextApiRequest, res: NextApiResponse) => {
return createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`,
);
}
: undefined,
})(req, res);
};
export default withIronSessionApiRoute(handler, sessionOptions);
this is how the handler looks like anyone got any idea why this could be happening? happens with both mutations and queries a normal request works to the api
const createInnerTRPCContext = (opts: CreateContextOptions) => {
console.log("DB FROM INNER CONTEXT", opts.db);
return {
db: opts.db,
request: opts.request,
};
};
const createInnerTRPCContext = (opts: CreateContextOptions) => {
console.log("DB FROM INNER CONTEXT", opts.db);
return {
db: opts.db,
request: opts.request,
};
};
even this doesn't log.. I don't know whats wrong at this point
FForkMeDaddy9/26/2023
Having the same problem
AKAlex / KATT 🐱9/27/2023
probably just a bad url or something

Looking for more? Join the community!

T
tRPC

Showing pending inside the request?

Join Server
Recommended Posts
Output properties missing on frontend results (Type Infer)My trpc client is inferring the type without some properties from the object (See images for explenAvoid checking for TRPCClientError, and return the error in client query/mutateWhat i'm trying to do, is avoid doing try/catch on every trpc call to backend, if ZOD validation faiProperty 'query' does not exist on type ...I think this is an issue on my end here is how I am defining everything ``` export const t = initTRPuseQueries passing ctx data to splitLink not workingWhen tRPC is implemented with splitLink using useQueries does not pass cxt parameters to splitLink. Build and Publish on lambda from Github ActionsTrying to send my TRPC API on Lambda AWS + API Gateway. I have follow the documentation. But now honext-pwa with trpc and push notificationHow can I build an app with next-pwa, trpc and push notification?Forced router input?I have a user route which has routes like get, delete, create etc. Some of the routes I require extrAuthentication with Expo applicationHi guys, I wan't to convert my current application stack to T3 stack. Current stack is: - NestJSOne router multiple adapters?Hey all! This might be misguided question, but I'm working on building an api with tRPC that will betRPC Express server with Next.jsAs much as I hate this, I am required to use Express for back-end and Next.js for front-end. I haveis Nextjs enough as backend?Hi guys, I'm new to tRPC and would like to rewrite my current project to use single monorepo insteaTS(2742) error when trying to create clientNPM with Node v18.16.1. I get the following error when trying to create a client. I've imported allWrapping useQuery into a custom hookI'm trying to wrap `useQuery` into a custom hook (as I have some legacy code that I need to run befoPass additional data from `useQuery` to contextFor `splitLink` there is a way to pass context value through `useQuery` as second param `{ trpc: { cCannot set headers in procedures with fetch adapterAm i right that with such a setup in nextjs app router route handler: ```ts const handler = async (rDoes anybody now how to fix cors policy error?I am facing this error: Access to fetch at 'http://localhost:3002/trpc/getBotTag?batch=1&input=%7B%7how to handle error from Zod in trpc?I would like to return error instead throwing it away so i could show user nice feedback i found htt404 TRPCError: no query procedure on pathHi, this is my entire standalone tRPC server:```ts import { initTRPC } from "@trpc/server"; import {Call multiple TRPC endpoints from onSuccess()?I would like to create an API chain for analysing a geographic area where one successful API call caHow to set sizeLimit > 1MB (to solve 413 error)?Hi all, I am trying out the T3 stack where I want to send area polygons given by the user to my Nex