Error: Tried to access "$types.__endpoint" which is not available at runtime
Hi all! I'm new here, so I hope i'm posting this in the right place. I'm trying to use tRPC using firebase functions, but I keep getting this error everytime I try to start everything up:
Error: Tried to access "$types.__endpoint" which is not available at runtime
at [blah]/functions/node_modules/@trpc/core/dist/index.js:344:23
Tried it both on the npm latest version, 10.45.0, and on the npm next version ^11.0.0-next-beta.193.
trpc.utils/ts
import { initTRPC } from "@trpc/server";
import { CreateExpressContextOptions } from "@trpc/server/adapters/express";
export const createContext = ({ }: CreateExpressContextOptions) => ({});
type Context = Awaited<ReturnType<typeof createContext>>;
export const t = initTRPC.context<Context>().create();
index.ts
import { aRouter } from "./routes/aRouter.routes";
import { t } from "./utils/trpc.utils";
import { onRequest } from "firebase-functions/v2/https";
import { createHTTPHandler } from "@trpc/server/adapters/standalone";
import cors from "cors";
export const appRouter = t.mergeRouters(aRouter);
export type AppRouter = typeof appRouter;
export const api = onRequest(createHTTPHandler({ router: appRouter, createContext: () => ({}), middleware: cors() }));
Any help would be much appreciated!0 Replies