Skip to content
New issue

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

subscription.stop method has no input, causing crash with superjson transformer #117

Closed
jthrilly opened this issue Feb 23, 2023 · 1 comment · Fixed by #118
Closed

subscription.stop method has no input, causing crash with superjson transformer #117

jthrilly opened this issue Feb 23, 2023 · 1 comment · Fixed by #118

Comments

@jthrilly
Copy link

I noticed a crash when using this lib with superjson. The stack trace indicated that superjson.deserialize was being called with the input being undefined.

A little digging and console logging led me to notice that this was happening for subscription.stop methods (which are being emitted here: https://github.com/jsonnull/electron-trpc/blob/main/packages/electron-trpc/src/renderer/ipcLink.ts#L77-L80) because they don't have an input property.

Thus when the handleIPCOperation function picks this up on the main thread, it is calling deserialize on an empty object (here: https://github.com/jsonnull/electron-trpc/blob/main/packages/electron-trpc/src/main/handleIPCOperation.ts#L23).

Seems like this function needs to look for the presence of operation.input before calling deserialize, or else filter by the operation method if it is a stable API.

@jsonnull
Copy link
Owner

Hey @jthrilly, thanks so much for reporting this issue! I don't think I would have personally run into this anytime soon 😅

Sorry for the delay getting back to you... I've pushed a patch up and it's out now in electron-trpc@0.4.2.

Please let me know if you have any more issues. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants