ippo
ippo17mo ago

fetch failed - error on npm start on production

I rebuild my next.js app with the npm run build command and I started it with npm start I get this error when I visit the site: (In development I have no problems)
now I get this error:
<< query #1 post.hello {
input: { text: 'from tRPC server!' },
result: transformResult_9a244fe7_TRPCClientError: fetch failed
at transformResult_9a244fe7_TRPCClientError.from (/Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:340:16)
at /Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:791:89
at runNextTicks (node:internal/process/task_queues:60:5)
at listOnTimeout (node:internal/timers:533:9)
at process.processTimers (node:internal/timers:507:7) {
meta: undefined,
shape: undefined,
data: undefined,
[cause]: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11118:11)
at runNextTicks (node:internal/process/task_queues:60:5)
at listOnTimeout (node:internal/timers:533:9)
at process.processTimers (node:internal/timers:507:7) {
cause: [InvalidArgumentError]
}
},
elapsedMs: 8,
context: {}
}
(node:19274) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
transformResult_9a244fe7_TRPCClientError: fetch failed
at transformResult_9a244fe7_TRPCClientError.from (/Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:340:16)
at /Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:791:89
.......
.......
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '4145997467'
now I get this error:
<< query #1 post.hello {
input: { text: 'from tRPC server!' },
result: transformResult_9a244fe7_TRPCClientError: fetch failed
at transformResult_9a244fe7_TRPCClientError.from (/Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:340:16)
at /Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:791:89
at runNextTicks (node:internal/process/task_queues:60:5)
at listOnTimeout (node:internal/timers:533:9)
at process.processTimers (node:internal/timers:507:7) {
meta: undefined,
shape: undefined,
data: undefined,
[cause]: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11118:11)
at runNextTicks (node:internal/process/task_queues:60:5)
at listOnTimeout (node:internal/timers:533:9)
at process.processTimers (node:internal/timers:507:7) {
cause: [InvalidArgumentError]
}
},
elapsedMs: 8,
context: {}
}
(node:19274) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
transformResult_9a244fe7_TRPCClientError: fetch failed
at transformResult_9a244fe7_TRPCClientError.from (/Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:340:16)
at /Users/ippo/tRPC-TEST/t3-next13-app/.next/server/chunks/376.js:791:89
.......
.......
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '4145997467'
1 Reply
ippo
ippoOP17mo ago
fixed the problem: fetch() was missing inside httpBatchLink this was missing:
// ...
httpBatchLink({
url: getUrl(),
fetch(url, options) {
return fetch(url, {
...options,
credentials: "include",
});
},
}),
// ...
// ...
httpBatchLink({
url: getUrl(),
fetch(url, options) {
return fetch(url, {
...options,
credentials: "include",
});
},
}),
// ...

Did you find this page helpful?