Prima client is causing Function App to give Error: Encountered an error (ServiceUnavailable) from host runtime.

Atin 0 Reputation points
2025-02-27T21:27:07.14+00:00

Hi,
I am deploying a nodejs app on Azure functions.
It works well, but then I need to integrate Prisma for DB interactions

As soon as i add code related to that:

import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient()

It starts giving error as Encountered an error (ServiceUnavailable) from host runtime.

I am not able to see in logs what is the exact reason of Error, as the docker container do not even start.

I have tried enabling and looking at Docker logs, can't find any real reason.

Here is the schema.prima, all standard stuff:

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

The only thing i see in docker logs is, which is not very helpful:

2025-02-27T00:17:04.042557826Z WEBSITES_INCLUDE_CLOUD_CERTS is set to true.
2025-02-27T00:17:04.158384433Z Updating certificates in /etc/ssl/certs...
2025-02-27T00:17:08.665364473Z 7 added, 0 removed; done.
2025-02-27T00:17:08.667196024Z Running hooks in /etc/ca-certificates/update.d...
2025-02-27T00:17:08.673442550Z done.
2025-02-27T00:17:08.862182625Z Starting OpenBSD Secure Shell server: sshd.

I am using publish command to deploy it:

func azure functionapp publish {functionname}

Obviously in this case I cannot run prisma generate on server, so I am running that locally and making sure we have prisma client files are in node_modules/.prisma/client folder

Can you help me troubleshoot it.

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

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.