Error while running shopify app on heroku "Error: Prisma session table does not exist"

Hey everyone!
I am facing some issue while running the shopify app on heroku.
it gives me the following error after deploying the successfully:

Can anyone knows how to resolve this error?

Hi, I have the same problem on Heroku, have you found a solution?

You can start by running heroku logs --tail from your project directory to view detailed logs, which can give you more insight into what’s causing the issue.

I recently ran into a similar problem with Prisma, and here’s how I resolved it:

It looks like there might be an issue with your database connection or the table setup. First, make sure you’ve added a Heroku Postgres database to your app:

  1. Go to your Heroku app dashboard.
  2. Navigate to the Resources tab.
  3. Add or create a Heroku Postgres database. Select the appropriate plan, and wait for it to be created and deployed.

Heroku should automatically generate a DATABASE_URL environment variable. Double-check that this variable is correctly set by going to the Settings tab and looking under Config Vars.

In your schema.prisma file, ensure that your datasource is set up correctly (assuming you’re using PostgreSQL):

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

Once that’s confirmed, run the following commands to apply your Prisma schema and migrations:

npm run prisma generate && npm run prisma migrate deploy

If everything runs smoothly with no errors, you can then deploy your app using:

shopify app deploy

If your Heroku app is linked to your GitHub repo, make sure to commit any changes. If not, you can manually deploy the app via the Deploy tab in Heroku.

However, if you encounter an issue with the Prisma migration (e.g., a migration failure), you can try resolving it with the following command:

npm run prisma migrate resolve --applied <YOUR_SESSION_FROM_FAILED_DEPLOYMENT_LOG> && npm run prisma migrate deploy

For more detailed steps, refer to the Prisma documentation on handling failed migrations:

If the problem persists, run heroku logs --tail again and share the details. We can help troubleshoot further from there.