Hi guys, I am currently having the following probl...
# prisma-client
o
Hi guys, I am currently having the following problem and hope you can point me to the right direction. I have a Lambda function that among other things writes to my AWS RDB database. This is working fine except for the case when one of the non-nullable input variables is null. My understanding is that in this case Prisma would throw an error. But it just hangs and the Lambda function times out after 60 seconds as follows (taken from AWS Cloudwatch logs) without any other error or notice:
Copy code
2021-12-09T02:11:42.536Z 38e30598-f091-5333-936d-5fb3975e21d6 Task timed out after 62.06 seconds
Is that normal behavior or do I need to change my settings so that an error is thrown by Prisma? This is my table definition:
Copy code
model tbl_Log {
  id Int @id @default(autoincrement())
  type LogType
  message String?
  createdAt DateTime
  user tbl_User @relation(fields: [userId], references: [id])
  userId String
  orderSnapshot Json
  amount Float
}
And I am creating the DB entry via:
Copy code
await prisma.tbl_Log.create({
      data: {
        type: log.type!,
        message: log.message!,
        createdAt: log.createdAt!,
        userId,
        orderSnapshot: log.orderSnapshot!,
        amount: log.amount ?? 0,
      },
    });
If
amount
is
null
, the Lambda function hangs at this step, if
amount
has a
number
it works (with 0, too).
m
This sounds like a red herring, in my cases it’s been I couldn’t get a connection to the database or otherwise; is that particular function inside of a VPC?
o
yes, it is in the same VPC as the RDB. Before doing the
.create
, there are other interactions with the DB which are working fine, like
.findUnique
. Could it still be that only the
.create
can’t get a connection?
m
hrm, not likely.
😔 1
o
Small update. I added debug logging and got the following error
Copy code
2021-12-09T06:05:48.374Z prisma:client:fetcher Error: Failed to validate the query: `Unable to match input value to any allowed input type for the field. Parse errors: [Query parsing/validation error at `Mutation.createOnetbl_Log.data.tbl_LogCreateInput.user`: A value is required but not set., Query parsing/validation error at `Mutation.createOnetbl_Log.data.tbl_LogUncheckedCreateInput.currencyAmount`: A value is required but not set.]` at `Mutation.createOnetbl_Log.data`
And I can also see that the currencyAmount value is NaN instead of 0 as it should be from my code. My question now is, why doesn’t this trigger the catch routine in my code?
another update. Reverting to prisma version 3.0.2 fixed the issue in that the error is now correctly caught.