Next.js Discord

Discord Forum

I'm getting error while passing id from dynamic route to prisma db query

Answered
Masked Duck posted this in #help-forum
Open in Discord
Masked DuckOP
Hi,
I have a problem with the id taken from dynamic route. I tried changing types, assigning to constants, unfortunately nothing helped. The most interesting thing is that several times it worked by itself and after refresh it stopped.
GET /_next/static/webpack/a6fe83e5bb7e3c82.webpack.hot-update.json 404 in 1757ms
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.
1
1
 ⨯ Error: Unknown element <[object Object]> in collection.
    at getFullNode.next (<anonymous>)
    at iterateCollection.next (<anonymous>)
    at Generator.next (<anonymous>)
digest: "3663509770"
 ⨯ Error: Unknown element <[object Object]> in collection.
    at getFullNode.next (<anonymous>)
    at iterateCollection.next (<anonymous>)
    at Generator.next (<anonymous>)
digest: "3663509770"
 GET /dashboard/equipment/1 500 in 3841ms
 GET /dashboard/equipment/1 500 in 222ms
renderer.js.map
installHook.js.map
 ⨯ PrismaClientValidationError: 
Invalid `prisma.equipment.findFirst()` invocation:

{
  where: {
+   id: {
+     equals: Int | IntFieldRefInput,
+     in: Int[],
+     notIn: Int[],
+     lt: Int | IntFieldRefInput,
+     lte: Int | IntFieldRefInput,
+     gt: Int | IntFieldRefInput,
+     gte: Int | IntFieldRefInput,
+     not: Int | NestedIntFilter
+   }
  },
  include: {
    fault: {
      orderBy: {
        id: "desc"
      },
      select: {
        id: true,
        present: true,
        title: true,
        createdAt: true,
        description: true,
        solution: true
      }
    },
    permissions: true,
    type: true
  }
}

Argument `id` is missing.
    at async EquipmentPage (./app/dashboard/equipment/[id]/page.tsx:32:23)
digest: "479857712"

1 Reply

Masked DuckOP
Answer