trpc error when deploying t3 app to AWS using sst
Deleted a different post about this issue. I'm trying to setup a t3 app on AWS and it is partially working. When I submit a new post using the CreatePost component, the page doesn't refresh and the error message I get is
TRPCClientError: Cannot read properties of undefined (reading 'resolve') at a.from (https://....)
If I manually refresh the page, the new post is updated in the UI, so it's hitting the db. When I check the network tab, the tRPC request I made returns with a 200 status code but the response is
47
{"0":{"result":{"data":{"json":null,"meta":{"values":["undefined"]}}}}
1
}
0
The trpc method is just this:
create: publicProcedure
.input(z.object({ myData: z.string().min(1) }))
.mutation(async ({ ctx, input }) => {
// simulate a slow db call
//await new Promise((resolve) => setTimeout(resolve, 1000));
await ctx.db.insert(posts).values({
myData: input.myData,
});
}),
Anyone having similar issues with this?Solution:Jump to solution
I didn't end up figuring out the issue, but I tried using server actions instead of tRPC and they do work, for anyone else having this issue.
3 Replies
Solution
I didn't end up figuring out the issue, but I tried using server actions instead of tRPC and they do work, for anyone else having this issue.
Had the same issue, Solution is enabling streaming for your nextjs site in sst since ct3a uses the httpBatchStream link
Or switch to the non streaming link
Came here to link to @NotLuksus 's post that addressed the same issue: https://discord.com/channels/966627436387266600/1186241634329952338