#How to use getDMMF

5 messages · Page 1 of 1 (latest)

inland oyster
#

I use the following code to load the dmmf from a absolute path:

const PYLON_ABSOLUTE_PATH = '/Users/schettn/Documents/pylon/pylon-template'

import {getDMMF} from '@prisma/internals'
// import {getDMMF} from '@prisma/sdk'

export default defineService({
  Query: {
    async prismaDMMF() {
      console.log(process.cwd())

      const dmmf = await getDMMF({
        datamodelPath: path.join(PYLON_ABSOLUTE_PATH, 'prisma/schema.prisma')
      })

      return dmmf
    }
  }
})

I get the following error:

GraphQLError: Get DMMF: Unable to resolve path to query-engine binary
Details: Could not find libquery-engine binary. Searched in:
- /Users/schettn/Documents/pylon/packages/pylon-server/studio-pylon/libquery_engine-darwin-arm64.dylib.node
- /Users/schettn/Documents/pylon/packages/pylon-server/studio-pylon/libquery_engine-darwin-arm64.dylib.node
- /Users/schettn/Documents/pylon/packages/pylon-server/libquery_engine-darwin-arm64.dylib.node
- /Users/schettn/Documents/pylon/packages/pylon-server/studio-pylon/runtime/libquery_engine-darwin-arm64.dylib.node
nimble cloudBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

inland oyster
#

The CWD: /Users/schettn/Documents/pylon/packages/pylon-server/studio-pylon

inland oyster
#

The query-engine exists under the following path:

packages/pylon-server/studio-pylon/node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node

#

Setting the cwd also does not change anything.

const dmmf = await getDMMF({
        cwd: process.cwd(),
        datamodelPath: path.join(PYLON_ABSOLUTE_PATH, 'prisma/schema.prisma')
      })