Skip to content

Compatibility with @trpc/client v11 #227

@MOhhh-ok

Description

@MOhhh-ok

Issue: Compatibility with @trpc/client v11

Problem

When using electron-trpc with @trpc/client v11, the following error occurs:

TRPCClientError: Cannot read properties of undefined (reading 'serialize')
    at TRPCClientError2.from (@trpc_client.js?v=8e462472:1695:12)
    at TRPCUntypedClient.requestAsPromise (@trpc_client.js?v=8e462472:2898:29)
    at async onClick (InputImagesDirectoryPane.tsx:11:25)
Caused by: TypeError: Cannot read properties of undefined (reading 'serialize')
    at electron-trpc_render…s?v=8e462472:523:31
    at Object.subscribe (electron-trpc_render…js?v=8e462472:35:18)
    at @trpc_client.js?v=8e462472:194:17
    at Object.subscribe (@trpc_client.js?v=8e462472:23:21)
    at startIfNeeded (@trpc_client.js?v=8e462472:94:29)
    at @trpc_client.js?v=8e462472:119:7
    at Object.subscribe (@trpc_client.js?v=8e462472:23:21)
    at @trpc_client.js?v=8e462472:68:31
    at new Promise (<anonymous>)
    at observableToPromise (@trpc_client.js?v=8e462472:58:19)

Reproduction

import { createTRPCProxyClient } from "@trpc/client";
import { ipcLink } from "electron-trpc/renderer";

export const trpcClient = createTRPCProxyClient<typeof appRouter>({
  links: [ipcLink()],
});

Solution

Downgrade @trpc/client and @trpc/server to v10.45.1:

npm install @trpc/[email protected] @trpc/[email protected]

Environment

  • electron-trpc: 0.7.1
  • @trpc/client: 11.4.0 (causing error)
  • @trpc/server: 11.4.0 (causing error)

Suggestion

Either:

  1. Update electron-trpc to support @trpc/client v11's new transformer API
  2. Document the version compatibility requirement in electron-trpc's README

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions