Generate drizzle migrations and push with drizzle kit with github actions for preview environments
Hello, so I am trying to deploy a preview environment with vercel and neon.
Using this tutorial: https://www.youtube.com/watch?v=jjRasfbeYHk (related repo: https://github.com/neondatabase/preview-branches-with-vercel/blob/main/.github/workflows/deploy-preview.yml) .
I have managed to make my workflow execute when I create a pull request, however I am running into issues when attempting to migrate and push those migrations to a generated neon branch. The repo above is using prisma, which is why I am having trouble using drizzle for this workflow instead.
When I run the workflow I get the error attached below.
This is my workflow step where it is failing.
The top two scripts in my package.json is what I am trying to execute:
This is my first time creating a github actions, so please let me know if I am doing this completley wrong, I am having trouble understanding how workflows are normally debugged without constantly test running them.
Every time I do run this workflow I am able to get the generated branch's connection string and manually run these commands by replacing the DATABASE_URL in my .env file and I run into no problems, I can even see all the data when I run my seed file, in both drizzle studio and on neon.
I thought it might not be working because I have drizzle-kit and pg and a dev dependency, but even when I made them regular depencies I get the same error.
Any help to point me in the right direction would be greatly appreciated, thankyou.
Neon
YouTube
Neon Developer workflow using Vercel and Github Actions
Learn how you can create a Neon branch for every Vercel Preview Deployment.
GitHub repository https://github.com/neondatabase/preview-branches-with-vercel
4 Replies
I have also tried it with this workflow step, but still same error: (the above image has npx npm run --, here it is npm run --)
If anyone else ran into the same problem, I fixed it by ensuring the depdencies are installed before this step, so I just added this before and it worked. But now I got a different error lol
Does anyone know how to add sslmode=require to a database url via the neonctl?
This is my current DATABSE_URL command
Nevermind fixed it, added the string after the neon cs command like this: