Hey guys, sorry to be that guy that joins and asks...
# orm-help
y
Hey guys, sorry to be that guy that joins and asks a question immediately but I need some help with deploying Prisma on Firebase Functions but I believe I'm getting an error because
PrismaClient
is not being generated. I've tried searching online and added this
postinstall
script in my
package.json
that does a
yarn prisma generate
but I'm lost at how that all works. For context -- I'm using Firebase Functions to schedule regular updates to update the database (Planetscale) and add new rows/prune old ones. Not sure if the error message helps but here's what Firebase Functions returned.
👀 1
a
Hey Yusuf, welcome to the community! How are you deploying your Firebase function? There error message seems to indicate the the
schema.prisma
file is not available to the function.
y
@Austin hey! thanks for the warm welcome. I deployed my function using
firebase deploy --only functions:<FUNCTION_NAME>
`firebase.json`:
Copy code
{
  "functions": {
    "source": ".",
    "predeploy": [
      "yarn build"
    ],
    "ignore": [
      "**/.env*",
      "**/.secret*",
      "**/*.log",
      "**/node_modules/**"
    ]
  }
}
`package.json`:
Copy code
// package.json
{
    ...
    "build": "yarn clean && node esbuild.config.js",
    ...
    "postinstall": "prisma generate"
}
I've also tried adding
cp prisma/schema.prisma dist
but was thrown another error:
Copy code
PrismaClientInitializationError: Query engine binary for current platform "debian-openssl-1.1.x" could not be found. This probably happens, because you built Prisma Client on a different platform. (Prisma Client looked in "/workspace/dist/query-engine-debian-openssl-1.1.x") Searched Locations: /.prisma/client <OMITTED>/serverless/question-service/node_modules/@prisma/client /workspace /workspace/dist /workspace/dist /tmp/prisma-engines /workspace/dist You already added the platforms "darwin", "debian-openssl-1.1.x" to the "generator" block in the "schema.prisma" file as described in <https://pris.ly/d/client-generator>, but something went wrong. That's suboptimal. Please create an issue at <https://github.com/prisma/prisma/issues/new> at BinaryEngine.getPrismaPath (/workspace/dist/index.js:456:3) at async /workspace/dist/index.js:458:1912 { clientVersion: '4.3.1', errorCode: undefined }
WIth the following
schema.prisma
Copy code
generator client {
  binaryTargets   = ["native", "debian-openssl-1.1.x"]
  provider        = "prisma-client-js"
  previewFeatures = ["referentialIntegrity"]
}
Update: I went to redo my Firebase Functions following the e2e test and that seemed to work.
v
👋 Hello @Yusuf Musa thank you for sharing the solution! I'm glad to hear that re-doing the functions ultimately resolved this 😊