trpc-nuxt
trpc-nuxt copied to clipboard
trpc useAsyncQuery/Any query fails with Node.js 18
Hey! This is a great library that I was trying out with nuxt.js and integrating it, but it was not working for me and after several hours of investigating, it seems like the reason is due to Node.js 18 which brought in the new fetch API, I checked that it's working in Node.js 16, though not sure what the problem is. Hope this can be fixed within this package and that it's not something inherently wrong with nodejs, otherwise please feel free to just close this issue. Here's the stack trace I had from doing client.query
Stack Trace:
TRPCClientError2: fetch failed
at Function.from (file:///.../.output/server/chunks/app/server.mjs:5075:14)
at file:///.../.output/server/chunks/app/server.mjs:5667:34 {
originalError: TypeError: fetch failed
at Object.processResponse (node:internal/deps/undici/undici:5555:34)
at node:internal/deps/undici/undici:5877:42
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8) {
cause: InvalidArgumentError: invalid connection header
at processHeader (node:internal/deps/undici/undici:2082:15)
at new Request (node:internal/deps/undici/undici:1965:13)
at [dispatch] (node:internal/deps/undici/undici:2891:25)
at Client.dispatch (node:internal/deps/undici/undici:408:33)
at [dispatch] (node:internal/deps/undici/undici:627:32)
at Pool.dispatch (node:internal/deps/undici/undici:408:33)
at [dispatch] (node:internal/deps/undici/undici:4174:27)
at Agent.dispatch (node:internal/deps/undici/undici:408:33)
at node:internal/deps/undici/undici:6255:83
at new Promise (
at ./server/chunks/app/server.mjs:5667:34
Interesting! Thanks for reporting. Probably related to this https://github.com/trpc/trpc/issues/1895
Hi! I am waiting for this PR to get merged for my next update.
Fixed https://github.com/wobsoriano/trpc-nuxt/releases/tag/v0.3.0