Title
h

Harsha MV

09/27/2021, 9:29 AM
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

Ryan

09/27/2021, 9:45 AM
What’s the query and data that you’re passing in this case?
h

Harsha MV

09/27/2021, 9:49 AM
@Ryan here is the dump https://pastebin.com/1NfmNs9h
trying to save a form submission with a Create command
r

Ryan

09/27/2021, 9:53 AM
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

Harsha MV

09/27/2021, 9:55 AM
yes i have it. this was the data dump.. this is the create command https://pastebin.com/MTDrTa7J
r

Ryan

09/27/2021, 9:59 AM
How does your
schema.prisma
look?
h

Harsha MV

09/27/2021, 10:13 AM
looks like the migration is causing all these problem 😞
it was working perfectly fine until i added new fields
Prisma Schema
r

Ryan

09/27/2021, 11:02 AM
It’s because your
data.marketPlaceId
is empty. To make it work change it to this:
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

Harsha MV

09/27/2021, 11:03 AM
oh yess
thanks will check this
💯 1
can we do the same for connect and create as well ?
r

Ryan

09/27/2021, 11:09 AM
Yes