PinkiePie
PinkiePie
TtRPC
Created by PinkiePie on 12/27/2024 in #❓-help
trpc doesn't work after migrating to next 15
thank you! ❤️
15 replies
TtRPC
Created by PinkiePie on 12/27/2024 in #❓-help
trpc doesn't work after migrating to next 15
https://github.com/trpc/trpc/issues/6341 - however it's mostly just a copy-paste of the discussion above, i don't have an isolated project where issue can be reproduced 😦
15 replies
TtRPC
Created by PinkiePie on 12/27/2024 in #❓-help
trpc doesn't work after migrating to next 15
@Alex / KATT 🐱 it seems like i narrowed down the issue to the exact file and commit 🙂 The change was introduced in this commit/line: https://github.com/trpc/trpc/commit/87fde62978441b1cedd1d5cf7290f6ade9a92607#diff-981f2f06bfbbee188e14a4f7991f370e9042eb5c21995e24e183ab76acc5ce01R136 and then here https://github.com/trpc/trpc/commit/3df8b21beb4925cf73194fc776d1a88603a3c420#diff-981f2f06bfbbee188e14a4f7991f370e9042eb5c21995e24e183ab76acc5ce01L136 req.socket exists locally with node, but it seems like it doesn't exist in lambdas environment (next adapter with netlify backed by aws). so, it fails on this line. In this env, request object is an instance of ComputeJsIncomingMessage class - I don't really know if it comes from next itself, or from lambdas, it's what i've seen when i put console.log in trpc code using yarn patch. It looks like this issue has nothing to do with nextjs upgrade, but with the fact i didn't pin exact trpc version but used "@trpc/server": "next", and it was unintentionally upgraded together with nextjs. As a temporary workaround i reverted it back to a version before this change was introduced (11.0.0-rc.608), and now everything works fine
15 replies
TtRPC
Created by PinkiePie on 12/27/2024 in #❓-help
trpc doesn't work after migrating to next 15
btw it's trpc 11.0.0-rc.666 and next 15.1.2 if it's anyhow could help
15 replies
TtRPC
Created by PinkiePie on 12/27/2024 in #❓-help
trpc doesn't work after migrating to next 15
@Alex / KATT 🐱
import { createNextApiHandler } from '@trpc/server/adapters/next';
import { createContext } from '../../../../lambdas/src/trpc/context';
import { appRouter } from '../../../../lambdas/src/trpc/router/_app';

// export API handler
export default createNextApiHandler({
router: appRouter,
createContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => {
console.error(`❌ tRPC failed on ${path}: ${error}`);
}
: undefined,
});

export const config = {
api: {
bodyParser: false,
responseLimit: '20mb',
},
};
import { createNextApiHandler } from '@trpc/server/adapters/next';
import { createContext } from '../../../../lambdas/src/trpc/context';
import { appRouter } from '../../../../lambdas/src/trpc/router/_app';

// export API handler
export default createNextApiHandler({
router: appRouter,
createContext,
onError:
process.env.NODE_ENV === 'development'
? ({ path, error }) => {
console.error(`❌ tRPC failed on ${path}: ${error}`);
}
: undefined,
});

export const config = {
api: {
bodyParser: false,
responseLimit: '20mb',
},
};
it works locally both with dev/prod build (both yarn next dev and yarn next build && yarn next start) , the issue happens only when i deploy to netlify
15 replies
TtRPC
Created by PinkiePie on 12/27/2024 in #❓-help
trpc doesn't work after migrating to next 15
btw, the issue is only with [trpc].ts routes; the ones that uses SSR with getServerSideProps works fine. and it also works fine locally, it fails only in prod (aws lambdas backed by netlify)
15 replies
TtRPC
Created by thomasplayschess on 9/13/2023 in #❓-help
Wrapping useQuery into a custom hook
does anybody know how to solve it with up-to-date trpc?
74 replies