```PrismaClientUnknownRequestError: Error occurred...
# orm-help
h
Copy code
PrismaClientUnknownRequestError: Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: ToSql(0), cause: Some(Error(Parser(InvalidLength { expected: Any([36, 32]), found: 0 }))) }) })
    at cb (/var/task/node_modules/@prisma/client/runtime/index.js:36956:17)
    at async handler (/var/task/.next/server/pages/api/projects.js:261:29)
    at async Object.apiResolver (/var/task/node_modules/next/dist/server/api-utils.js:101:9)
    at async Server.handleApiRequest (/var/task/node_modules/next/dist/server/next-server.js:760:9)
    at async Object.fn (/var/task/node_modules/next/dist/server/next-server.js:651:37)
    at async Router.execute (/var/task/node_modules/next/dist/server/router.js:205:32)
    at async Server.run (/var/task/node_modules/next/dist/server/next-server.js:825:29)
    at async Server.handleRequest (/var/task/node_modules/next/dist/server/next-server.js:292:20)
    at async Server.<anonymous> (/var/task/___next_launcher.js:32:9) {
  clientVersion: '3.1.1'
}
Any idea why this error happens?
r
What’s the query and data that you’re passing in this case?
h
@Ryan here is the dump https://pastebin.com/1NfmNs9h
trying to save a form submission with a Create command
r
Does this data match with what the
prisma
method accepts?
projectMedia
seems like a relation so you would need to use
connect
or
create
.
h
yes i have it. this was the data dump.. this is the create command https://pastebin.com/MTDrTa7J
r
How does your
schema.prisma
look?
h
looks like the migration is causing all these problem 😞
it was working perfectly fine until i added new fields
Prisma Schema
r
It’s because your
data.marketPlaceId
is empty. To make it work change it to this:
Copy code
marketPlace: data.marketPlaceId
        ? {
            connect: {
              id: data.marketPlaceId,
            },
          }
: {},
Best to do this for all relations in which you think the
id
might be empty or
undefined
/`null`.
h
oh yess
thanks will check this
💯 1
can we do the same for connect and create as well ?
r
Yes
120 Views