Hi @jonasgroendahl I'm one of the authors of
aws-samples/prisma-lambda-cdk
repo and I recently found that it's much simpler and reproducible to use Docker Lambda for bundling a Lambda function with Prisma than zip bundling. It has less dependency on CDK (basically we just use Docker Lambda, notNodejsFunction
construct) so it should be easy to rewrite with Pulumi.
I just published a Serverless Stack (CDK-based tool) + Prisma + Lambda sample repo here https://github.com/jetbridge/sst-prisma
It handles migrations with the SST Script construct which is a custom CF resource that can be run on create/update, it runs my prisma migrations automatically when doing a CDK deploy.
Prisma Migrate: programmatic access to CLI commands (deploy, reset...)
Problem
It would be nice to have a way to run the migrate programmatically. I am running into an issue where my api is using lambdas (serverless) and my database is only accessible from within an aws vpc. Because of this I cannot "execute commands" on deploy in an easy way. My current solution is to ssh into an ec2 that is within the vpc, execute the prisma commands, and then spin the ec2 back down. While this is working, it is far from ideal. If I was instead able to have a separate lambda that had all the migration data bundled with it I could execute the migration from a lambda (that is within the vpc).
While this may seem like a specialized use case, databases that are not publicly accessible are common place, and solutions for migration that don't include running npm commands from the cli I think become critical.
Solution
Alternatives
Stated above, no great alternatives for common usecases.