We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.1.8+89d25807f
Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
import { initTRPC } from '@trpc/server'; import { createHTTPServer } from '@trpc/server/adapters/standalone'; const t = initTRPC.create(); export const router = t.router; export const publicProcedure = t.procedure; const appRouter = router({ greeting: publicProcedure .input({parse: (c)=>c}) .mutation(({input}) => `Hello ${input.name}`), }); createHTTPServer({ router: appRouter, createContext() { return {}; }, }).listen(2022); export type AppRouter = typeof appRouter;
import { createTRPCClient, httpBatchLink } from '@trpc/client'; import type { AppRouter } from './index'; const client = createTRPCClient<AppRouter>({ links: [ httpBatchLink({ url: 'http://localhost:2022/', }), ], }); console.log(await client.greeting.mutate({name: 'Kranga'}));
The same as when index.ts is executed with ts-node.
ts-node index.ts bun client.ts
ts-node index.ts
bun client.ts
console logs Hello Kranga on the client
Hello Kranga
bun index.ts bun client.s
bun index.ts
bun client.s
An error is thrown:
42 | constructor(message, opts){ 43 | const cause = opts?.cause; 44 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment 45 | 46 | // @ts-ignore https://github.com/tc39/proposal-error-cause 47 | super(message, { ^ TRPCClientError: JSON Parse error: Unexpected EOF
Apparently it has to do with streams since it seems the request body is empty when trpc attempts to read it.
No response
The text was updated successfully, but these errors were encountered:
minimal reproduce
const http = require("http"); const server = http.Server((req, res) => { setTimeout(() => { console.log(req.read()?.toString()); res.end() }) }).listen(0, async () => { const req = http.request({ port: server.address().port, method: 'POST' }, () => server.close()); req.write('test message'); req.end(); })
❯ bun reproduce.cjs undefined ❯ node reproduce.cjs test message
Sorry, something went wrong.
No branches or pull requests
What version of Bun is running?
1.1.8+89d25807f
What platform is your computer?
Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
What is the expected behavior?
The same as when index.ts is executed with ts-node.
ts-node index.ts
bun client.ts
console logs
Hello Kranga
on the clientWhat do you see instead?
bun index.ts
bun client.s
An error is thrown:
Apparently it has to do with streams since it seems the request body is empty when trpc attempts to read it.
Additional information
No response
The text was updated successfully, but these errors were encountered: