What exactly i am doing wrong.. Prepared Query

[{
    "error": {
        "json": {
            "message": "prepared statement \"preparedConfig\" already exists",
            "code": -32603,
            "data": {
                "code": "INTERNAL_SERVER_ERROR",
                "httpStatus": 500,
                "path": "config.fetch",
                "zodError": null
            }
        }
    }
}]


export const preparedConfig = db.query.config
  .findFirst({
    with: { ads: true, banners: true },
    orderBy: [asc(config.config.id)],
  })
  .prepare("preparedConfig");

// Calling using trpc

  fetch: publicProcedure.query(async ({ ctx }) => {
    return await preparedConfig.execute();
  }),
Was this page helpful?