Azure FunctionsPrisma error

星川 健太 0 Reputation points
2025-04-21T01:54:54.71+00:00

I'm using Prisma with Azure Functions. Since the functions restarted at 3:20 AM (JST) on April 19, the following error has been occurring:

log
[error] Worker uncaught exception (learn more: https://go.microsoft.com/fwlink/?linkid=2097909 ): PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "debian-openssl-1.1.x". This happened because Prisma Client was generated for "debian-openssl-3.0.x", but the actual deployment required "debian-openssl-1.1.x". Add "debian-openssl-1.1.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:

generator client {
  provider = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-1.1.x"]
}

The following locations have been searched:
/home/site/wwwroot/node_modules/.prisma/client
/home/site/wwwroot/node_modules/@prisma/client
/home/runner/work/ep-monitor/ep-monitor/src/backend/node_modules/@prisma/client
/tmp/prisma-engines
/home/site/wwwroot/prisma
    at za (/home/site/wwwroot/node_modules/@prisma/client/runtime/library.js:64:805)
    at async Object.loadLibrary (/home/site/wwwroot/node_modules/@prisma/client/runtime/library.js:111:10084)
    at async _r.loadEngine (/home/site/wwwroot/node_modules/@prisma/client/runtime/library.js:112:448)
    at async _r.instantiateLibrary (/home/site/wwwroot/node_modules/@prisma/client/runtime/library.js:111:12599)

As a result, all API calls were failing. Re-deploying the functions made the API calls succeed again, but the same error occurs after a crash.

If you are aware of similar cases or have any hints, I’d appreciate your advice.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shireesha Eeraboina 3,435 Reputation points Microsoft External Staff Moderator
    2025-04-21T05:20:58.1966667+00:00

    Hi 星川 健太,

    The error you are encountering with Prisma in Azure Functions is due to a mismatch between the Prisma Client's generated binary and the runtime environment. Specifically, your Prisma Client is generated for "debian-openssl-3.0.x," while the Azure Functions environment is looking for "debian-openssl-1.1.x."

    To resolve this, you need to update your schema.prisma file to include "debian-openssl-1.1.x" in the binaryTargets section, like this:

    generator client {
      provider = "prisma-client-js"
      binaryTargets = ["native", "debian-openssl-1.1.x"]
    }
    

    After making this change, run prisma generate to regenerate the Prisma Client with the correct binary target. This should help prevent the error from occurring after your functions restart.

    To help you better understand, kindly refer to the documentation below:

    For more clarification on these issue please refer the below links as well.

    https://learn.microsoft.com/en-us/answers/questions/2183649/prima-client-is-causing-function-app-to-give-error

    https://stackoverflow.com/questions/79474093/prisma-client-is-causing-function-app-to-give-error-encountered-an-error-servi

    I hope this addresses your query. Please let me know if you need any further assistance or clarification.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.