question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarify that @trpc/server is needed as a dependency in the client

See original GitHub issue

This is not really a bug, but I thought it would help others if this is made a bit more clear. 🙂

We have a monorepo, in which I installed @trpc/client and @trpc/server in different packages.

However, I did not add @trpc/server to the client.

Because of how the packages are (not) hoisted, this resulted in the client not being able to infer the types correctly and using any as output without errors.

The reason is that @trpc/client needs the server package to be available. But Typescript did not complain, due to the skipLibCheck option, I guess.

Ways to improve this

  • This should have resulted in an error ideally.

  • At least, the instructions on the website could instruct to install @trpc/server as a devDependency in the client.

  • Another idea would be to have @trpc/core, which is maybe more intuitive than having @trpc/server as a dependency in the client?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
davazpcommented, Jan 26, 2022

It probably did, but it is a large project full of many other peerDependency warnings so I missed it. 😨

0reactions
davazpcommented, Jan 27, 2022

There’s risk of multiple installs with that solution unfortunately

True, if both @trpc/client and @trpc/server are installed on the same package, as in the examples, it is true that then we rely on the package manager to hoist them / deduplicate.

Although, that already happens in my setup unfortunately, as the client needs @trpc/server, I have two copies of it. Depending on the package manager, that might or might not be hoisted.

In my case, it is not, so I do have two copies of @trpc/server. It seems fine because it’s used for the types and they are version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows Server Troubleshooting: RPC server is unavailable
The RPC protocol is based on a client/server model. The client makes a procedure call that appears to be local but is actually...
Read more >
RPC Chains: Efficient Client-Server Communication ... - USENIX
We propose the RPC chain, a simple but powerful communication primitive that allows an application to lessen the performance effects of wide-area links...
Read more >
5.3 Remote Procedure Call — Computer Networks
After the server procedure completes, it returns in a reply message that it hands off to the RPC protocol for transmission back to...
Read more >
RPC server is unavailable: 0x800706ba | How to fix this error
The RPC server is unavailable” is one of the most frequent error messages in Windows. But never fear! It is very easy to...
Read more >
How to Fix 'RPC Server is Unavailable' Error in Windows
You needn't worry, however, as it isn't a serious or dangerous error, so all of your programs and data are safe. What RPC...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found