Bad request in prod but works fine in dev

in prod I am getting BAD REQUEST
A
acronie224d ago
No description
A
acronie224d ago
Nothing logs on the server If anyone has any idea let me know please I am stuck deploying my application useQuery works fine for now. and other mutations too
N
Nick224d ago
o.from sounds a lot like you’re sending over some bundled JS instead of JSON
A
acronie224d ago
bundled js? do I need to stringify the object I am passing? I dont think so right?
scheduleInterview.mutate({
employeeId,
startTime: dayjs(dateTime).toDate(),
});
scheduleInterview.mutate({
employeeId,
startTime: dayjs(dateTime).toDate(),
});
this is what it is
N
NeoBean224d ago
could be caused by the Date() object
A
acronie224d ago
coming from dayjs? How tho? I feel its that too but not really sure z dateTime is coming from datetime input @neobean
N
NeoBean224d ago
well toDate() method returns an entire javascript Date() class
A
acronie224d ago
Hmmm But how does it work in dev mode? I would surely see something
N
NeoBean224d ago
idk honestly, but im curious
A
acronie224d ago
export const ScheduleInterviewSchema = z.object({
employeeId: z.string().nonempty(),
startTime: z.date(),
});
export const ScheduleInterviewSchema = z.object({
employeeId: z.string().nonempty(),
startTime: z.date(),
});
using z.date which expects the whole date ig
N
NeoBean224d ago
and you're using superjson too right?
A
acronie224d ago
I assume yes Id need to check yes I am transformer: superjson,
N
NeoBean224d ago
if its not for the date, it could be for anything, you need debug chunk by chunk ¯\_(ツ)_/¯
A
acronie224d ago
this is the payload of the network request
No description
A
acronie224d ago
{
"0": {
"json": {
"employeeId": "clm8uz2zd0000mc2hucjj3czl",
"startTime": "2023-09-07T15:22:00.000Z"
},
"meta": {
"values": {
"startTime": [
"Date"
]
}
}
}
}
{
"0": {
"json": {
"employeeId": "clm8uz2zd0000mc2hucjj3czl",
"startTime": "2023-09-07T15:22:00.000Z"
},
"meta": {
"values": {
"startTime": [
"Date"
]
}
}
}
}
whcih i think is valid date too idk whats causing the error then
N
NeoBean224d ago
are you using errorFormatters / try catch anywhere that just throws BAD_REQUEST/INTERNAL_SERVER_ERROR but doesnt log or respond with a proper message/error data? also you using mongodb? if employeeId is supposed to be an objectId, its invalid have you tried running the production mode locally? is everything same for both dev/prod? like payload, database configuration/indexes etc
A
acronie224d ago
no Works locally
More Posts
hey is there any way to integrate or implement machine learning / ai in trpcSpecifically for next.js or tensorflow?How to serve files with trpc?Is is possible to serve files with trpc? E.g., by creating a middleware and returning directly from tRPC in Next without api rotesHello! I have NextJS app that gets data in gSP using some third-party client. This data comes untypegetting the progress of a trpc queryHello, I want to be able to stream the progress of a trpc client query call, so I can link it to a pwrapper on useMutation (and another for useQuery) for creating multiple hookshi i want to create a wrapper for my router, basically I would like to achive somethink like that useQuery returning old data with new paramsI have a react component that takes in a date range and calculates a users net worth (sums up all asCalling a tRPC service from another tRPC serviceI have 2 services (App1 and Service2) App1 is client facing and uses trpc well But occasionally App1charset=utf8 results in empty inputI'm using trpc-openapi and some of our customers are using Zapier to communicate with it. Zapier usIs there a way to alter the query key generated by trpc?I want to pass a boolean flag (`initial`) to the backend saying if it's a first call of a given procuseMutation throwing 500 errorsI've setup my next 13 app router project and started using some queries that worked fine, however thTRPC Nextjs App Router API Base URLIs there any issues with me placing trpc route handler in the root of my api folder? I don't really Turborepo, nextjs, vite react app, express serverI have following structure Apps: First Frontend - Nextjs app Second Frontend - Vite ReactApp BackenRouter/Middleware Chaining in V10Heyo, finally migrating from v9 to v10 after putting it off for a while. Is it just me, or is this mthrowing custom errors from mutationsany idea why trpc is ignoring the catch expression? it just throws its own error about unique consttrpc in a pnpm monorepoHi all 👋 I was wondering if there is a recommended setup for monorepos, in our case with pnpm workTS Error with React when creating client "useContext" collides ....when creating the client i get following error: The property 'useContext' in your router collides wType 'NextRequest' is missing properties from type 'NextApiRequest'Enviorment: Node 18, pnpm Hi, I'm facing an error, where in my app i get this error at `createTRPCCType '{}' is not assignable in server queryType '{ input: { slug: string; }; "": any; }' is not assignable to type 'string | StringFilter<"CateThe inferred type of this node exceeds the maximum length the compiler will serialize.Using HTTP:POST for `query`?Hey guys, thanks for the awesome library! My application involves making a `query` with a large am