External ORM (Prisma) with @forge/resolver fails during snapshotting

Hi! I am trying to use Prisma for storing relational data on an app I am developing. However, upon instantiating the client connection, it fails during deployment.

Here is my code:

import Resolver from '@forge/resolver';
const resolver = new Resolver();
import { PrismaClient } from '@prisma/client';


resolver.define('getText', (req) => {
    console.log(req);

    return 'Hello, world!';
});

resolver.define('getResources', (req) => {
     const client = new PrismaClient();
     return await client.resource.findMany();
});

export const handler = resolver.getDefinitions();

This code runs fine during linting and build, but fails during the snapshot process. Here is a preview of the error.

I have been looking for any workaround but I haven’t seen this issue on the forum.

Hoping for your response. Best regards,

Ivan

The current forge runtime doesn’t support all of the node libs ( see https://developer.atlassian.com/platform/forge/runtime-reference/#javascript-environment ). You’re more than likely hitting that. The only work around is to set up your own microservice with your own authentication etc.