How to hide database ip when using tRPC + Prisma
Solution:Jump to solution
can you remove the stack and the shape.message from the error before returning for the client?
31 Replies
check the log level
but i think in production there will be no stacktrace
you mean this? I didn't touch these before
try building the app and starting
and check the error
next build
next start
i change my db url to
postgresql://postgres:test@test:1234/postgres
, so you can see the error with db ipError Handling | tRPC
Whenever an error occurs in a procedure, tRPC responds to the client with an object that includes an "error" property. This property contains all the information that you need to handle the error in the client.
you can check dealing with errors on the trpc side of things
before they bubble up to the next side of things
it still send the error to client
there is a NODE_ENV in your .env.local file?
no
try adding
NODE_ENV=production
and see what happensSolution
can you remove the stack and the shape.message from the error before returning for the client?
wow that's work
thx
glad to help
I think if you're in production you'll not get the stacktrace
Iām sure this is production, if not I will get prisma log in the terminal.
in production there's no @tanstack/react-query-devtools and Tailwind Indicator as well
so you're not in production š
. Btw did you set the env variable NODE_ENV to "production" ?
ok
this is production
I removed it
i'm showing you if not in production I will get these things
Ha
let me create a demo
GitHub
GitHub - nekochan0122/t3-db-ip-demo
Contribute to nekochan0122/t3-db-ip-demo development by creating an account on GitHub.
a solution by nyx