-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
โฎ needs reproductionHelp us help you - make a failing testHelp us help you - make a failing testโณ close if no activityWill be closed if no activity happens within a few weeksWill be closed if no activity happens within a few weeks๐ bug: unconfirmed
Description
Provide environment information
System:
OS: macOS 26.0.1
CPU: (16) arm64 Apple M3 Max
Memory: 7.70 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.13.1 - /Users/xxx/.volta/tools/image/node/22.13.1/bin/node
Yarn: 1.22.22 - /Users/xxx/.volta/tools/image/yarn/1.22.22/bin/yarn
npm: 11.3.0 - /Users/xxx/.volta/tools/image/npm/11.3.0/bin/npm
bun: 1.3.0 - /Users/xxx/.bun/bin/bun
Browsers:
Chrome: 141.0.7390.108
Edge: 141.0.3537.71
Firefox: 142.0.1
Safari: 26.0.1
npmPackages:
@trpc/client: ^11.5.1 => 11.5.1
@trpc/server: ^11.5.1 => 11.5.1
react: ^19.1.1 => 19.1.1
typescript: ^5.9.2 => 5.9.2
Describe the bug
I tried multiple things to make sure that Datadog sees the actual error being thrown, but no matter what I did, the error is always the same (screenshot attached).
This is my current logger (it was much simpler before, but I tried to recursively find the cause error with no luck).
import { TRPCError } from '@trpc/server';
import * as trpcExpress from '@trpc/server/adapters/express';
import express from 'express';
import logger from 'server/logger';
import { createContext } from 'server/trpc/context';
import { trpcRouter } from 'server/trpc/mainRouter';
function getLoggableError(error: unknown): unknown {
if (error instanceof Error && error.cause instanceof Error) {
return getLoggableError(error.cause);
}
return error;
}
export function initTRPC(app: express.Application) {
app.use(
'/api/trpc',
trpcExpress.createExpressMiddleware({
router: trpcRouter,
createContext: createContext,
onError: ({ error, path, type, input }) => {
if (error instanceof TRPCError && error.code === 'INTERNAL_SERVER_ERROR') {
const loggable = getLoggableError(error);
logger.error(loggable, {
path,
type,
input: type === 'query' ? input : undefined,
trpcCode: error.code,
trpcMessage: error.message,
trpcStack: error.stack,
});
}
},
})
);
}and this is how the error is being reported:
so basically I have no way of knowing what the actual error is unless I try/catch the procedure itself
Link to reproduction
n/a
To reproduce
n/a
Additional information
No response
๐จโ๐งโ๐ฆ Contributing
- ๐โโ๏ธ Yes, I'd be down to file a PR fixing this bug!
Metadata
Metadata
Assignees
Labels
โฎ needs reproductionHelp us help you - make a failing testHelp us help you - make a failing testโณ close if no activityWill be closed if no activity happens within a few weeksWill be closed if no activity happens within a few weeks๐ bug: unconfirmed