Replies: 3 comments 21 replies
-
Currently we do not support running migrate programmatically yet. You can use As for bundling, I would suggest keeping bundling: {
sourceMap: true,
nodeModules: ['@prisma/client', 'prisma']
} Then running |
Beta Was this translation helpful? Give feedback.
-
One unfortunate side effect of using |
Beta Was this translation helpful? Give feedback.
-
Quick question parallel to our "figuring technical things out" comment thread above: Why do you want to run Migrations via a serverless functions? Usually our users do that via the Prisma CLI in a build step that happens on CI or on their local machine. Do you have a use case where this would not work? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to figure out how to run prisma migrations using AWS Lambda. I am not using the Serverless framework, I am using this template (why) and trying to adapt it to Prisma.
I don't really understand how I can run migrations. My idea is to create a lambda function that runs the migrations programatically. I don't really see an API for doing so. I tried to cram the CLI migration script into a NodejsFunction CDK construct but I have encountered a problem doing that. When I run the script I get:
Looking through
@prisma/migrate
I see a number of places where it tries to require../package.json
. This does not work with JavaScript bundling because all dependencies are bundled into a single file, there is nonode_modules
directory structure. AWS's officialNodeJsFunction
uses esbuild to bundle everything into anindex.js
.Questions:
@prisma/migrate
not explode on import if it's part of a bundle and doesn't have a../package.json
file in the local path?Migration script:
This is what I hacked together:
And the CDK construct:
Beta Was this translation helpful? Give feedback.
All reactions