ORM in Freshdesk Serverless

Hi @kaustavdm, thanks for reply!

sorry about the topic, but I’m newbie with prisma.

I was following the prima quick start and made the following code in server.js, just to debug the error.

const { PrismaClient } = require("@prisma/client");

exports = {
  onTicketCreateHandler: async function (args) {
    try {
      const prisma = new PrismaClient();
      console.log(prisma);
    } catch (err) {
      console.log(err);
    }
  },
};

This is the schema.prisma file:

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = "postgresql://postgres:postgres@localhost:5432/prisma_test"
}

// models

The error I had was:
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.

I had already run this command and didn’t work.
If I put the new PrismaClient() outside the function, the fdk output is just undefined.

I have no idea how to fix it.

1 Like