mrmcgri
TTCTheo's Typesafe Cult
•Created by mrmcgri on 1/4/2024 in #questions
Two trpc t3 stack apps, trpc call between the two.
@Rhys as reece It is a monorepo. The plan is to have 3-4x apps in it , with shared ui & config packages. The apps will have their own db&trpc setup, plus communicating with 2 common API. The API endpoints will also be upsold to 3rd parties. So my plan was to make apps communicate with the API app via trpc, so I have single common code style. I.e everything done via TRPC & tanstack query, and avoid the whole mess of using fetches, states and etc.
7 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 1/4/2024 in #questions
Two trpc t3 stack apps, trpc call between the two.
now, I need to figure out how to get useQuery working, right now it is just: const data = exchangeApi.purchase.getAllProjects.query({ key: "123" });
7 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 1/4/2024 in #questions
Two trpc t3 stack apps, trpc call between the two.
CORS issue is solved by adding following at both ends: headers: async () => {
return [
{
source: "/api/:path",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "" }, // replace this with your actual origin in production
{
key: "Access-Control-Allow-Methods",
value: "GET,DELETE,PATCH,POST,PUT",
},
{
key: "Access-Control-Allow-Headers",
value:
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version,trpc-batch-mode",
},
],
},
];
},
7 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 1/4/2024 in #questions
Two trpc t3 stack apps, trpc call between the two.
I changed createTRPCNext to createTRPCProxyClient. Now B received and executes the request. but in browser with app A open, I am getting cross origin issue: Origin http://localhost:3001 is not allowed by Access-Control-Allow-Origin. Status code: 204 . But server B is executed the request..i.e pulled data from DB. Confusing.
7 replies
TTCTheo's Typesafe Cult
•Created by aditya on 4/2/2023 in #questions
prefetchInfinite on getServerSideProps using SSG helpers
I have same code as you, more or less. It works. The error complains about you having issues in your env setup. Anyway, in case it help my code: export async function getServerSideProps() {
const helpers = createServerSideHelpers({
router: appRouter,
ctx: { prisma } as any,
transformer: superjson, // optional - adds superjson serialization
});
const initialData = await helpers.discovery.getFollowingRecipes.prefetchInfinite({ limit: 20, cursor: 6 });
return {
// Passed to the page component as props
props: {
trpcState: helpers.dehydrate(),
},
revalidate: 60,
};
2 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 10/28/2022 in #questions
t3-turbo monorep, install packages in sub folders
@barry solved it 😄 the error is misleading a bit. Habbits of reading only the last line XD . the issue was in DB connection string, not in WARN Local package.json exists, but node_modules missing,
11 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 10/28/2022 in #questions
t3-turbo monorep, install packages in sub folders
@barry I followed the README 1:1 😦 and it didn't install anything but root node_modules
11 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 10/28/2022 in #questions
t3-turbo monorep, install packages in sub folders
my root package.json is the same as https://github.com/t3-oss/create-t3-turbo/blob/main/package.json
11 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 10/28/2022 in #questions
t3-turbo monorep, install packages in sub folders
sorry, not following 🙂
11 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 10/28/2022 in #questions
t3-turbo monorep, install packages in sub folders
Ye, i did ran it from root
11 replies
TTCTheo's Typesafe Cult
•Created by mrmcgri on 10/28/2022 in #questions
t3-turbo monorep, install packages in sub folders
mm
11 replies