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.
image.png
image.png
image.png
image.png
YouTubeNeon
Learn how you can create a Neon branch for every Vercel Preview Deployment.

GitHub repository https://github.com/neondatabase/preview-branches-with-vercel
Was this page helpful?