prisma: Prisma2 not working with netlify-lambda

I am using the netlify lambda cli. Not the netlify cli. https://github.com/netlify/netlify-lambda

Following up from the discussion here: https://github.com/prisma/prisma2/issues/952

When I try to run prisma2 generate I get this error

Error: The `platforms` field on the generator definition is deprecated. Please rename it to `binaryTargets`.

When I switch platforms to binaryTargets it runs generate fine. But I still get this error on invocation

Request from ::1: GET /.netlify/functions/hello
Response with status 500 in 528 ms.
Error during invocation:  Error: Error in Photon: 
Error: Photon binary for current platform darwin could not be found.
Photon looked in null but couldn't find it.
Make sure to adjust the generator configuration in the schema.prisma file:
generator photon {
  provider      = "photonjs"
  binaryTargets = ["native", "rhel-openssl-1.0.x", "darwin"]
}
Please run prisma2 generate for your changes to take effect.
Note, that by providing `native`, Photon automatically resolves `darwin`.
Read more about deploying Photon: https://github.com/prisma/prisma2/blob/master/docs/core/generators/photonjs.md
    at NodeEngine.getPrismaPath (~/bot-slack/lambda/hello.js:1:894920)
    at async ~/bot-slack/lambda/hello.js:1:896510
    at u.<anonymous> (~/bot-slack/lambda/hello.js:1:2379)
    at Generator.throw (<anonymous>)
    at u (~/bot-slack/lambda/hello.js:1:1380)

Here is my generator section of my schema.prisma

generator photon {
  provider = "photonjs"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

Even if I try adding darwin to that list it still errors, and just adds another darwin to the error message.

Make sure to adjust the generator configuration in the schema.prisma file:

generator photon {
  provider      = "photonjs"
  binaryTargets = ["native", "rhel-openssl-1.0.x", "darwin", "darwin"]
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 15 (10 by maintainers)

Most upvoted comments

Hello from Netlify! In the years since netlify-lambda was created, we’ve since released direct bundling and shipping of JavaScript functions, so you no longer need to add a step to build your functions using netlify-lambda.

Also, as @pantharshit00 noted, we added the dev command to Netlify CLI, which serves JS functions directly, again with no need for a separate build tool. (The docs reflect these recommendations as well.)

The one remaining functionality that netlify-lambda provides is webpack bundling. We’re currently working on expanding our functions bundler options directly in the build, so we’ll soon be able to replace that functionality, too. When that happens, we’ll be able to archive netlify-lambda.

Thank you so much for this update @verythorough - considering this development I think it is safe for us to close this issue and focus our efforts on other areas.

Please open a new, separate issue @heymartinadams - then someone will try to help you.