umami
umami copied to clipboard
Failed Netlify + Supabase
Steps to reproduce:
-
Open Supabase
-
Create database
-
Open
Settings
/Database
/Connection Pooling
-
Copy
Connection string
, replace[YOUR-PASSWORD]
with password, add?pgbouncer=true
to string -
Open
SQL editor
, paste code from here and click RUN -
Open Netlify
-
Connect forked repo with project
-
Open
Site settings
/Build & deploy
/Enviorenment
-
Add variables
HASH_SALT
with random string andDATABASE_URL
with our updated connection string -
Open
Deploys
, clickTrigger deploy
After these steps I get the following error:
9:12:48 PM: Error: P3018
9:12:48 PM:
9:12:48 PM: A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
9:12:48 PM:
9:12:48 PM: Migration name: 02_add_event_data
9:12:48 PM:
9:12:48 PM: Database error code: 42501
9:12:48 PM:
9:12:48 PM: Database error:
9:12:48 PM: ERROR: must be owner of table event
9:12:48 PM:
9:12:48 PM: DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42501), message: "must be owner of table event", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("aclchk.c"), line: Some(3583), routine: Some("aclcheck_error") }
9:12:48 PM:
9:12:48 PM: ✗ Command failed: prisma migrate deploy
9:12:48 PM: Error: P3018
9:12:48 PM:
9:12:48 PM: A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
9:12:48 PM:
9:12:48 PM: Migration name: 02_add_event_data
9:12:48 PM:
9:12:48 PM: Database error code: 42501
9:12:48 PM:
9:12:48 PM: Database error:
9:12:48 PM: ERROR: must be owner of table event
9:12:48 PM:
9:12:48 PM: DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42501), message: "must be owner of table event", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("aclchk.c"), line: Some(3583), routine: Some("aclcheck_error") }
9:12:48 PM:
9:12:48 PM:
9:12:48 PM:
9:12:48 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
9:12:48 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
9:12:48 PM: ERROR: "check-db" exited with 1.
9:12:48 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
9:12:48 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Seems to be on your database configuration side. I use Netlify with a postgresql database on heroku, I have no error (just deployed few minutes ago with the latest version of umami).
Ok you got this error. But what did you try to do to fix it?
It seems that I do everything according to the documentation
Don't understand why you follow Supabase documentation if you want to use Netlify ?
I just follow netlify documentation (without useless HASH_SALT environment variable) using the postgres connection string (without pgbouncer=true
option) and it works well.
https://umami.is/docs/running-on-netlify
What I did :
- Clone umami fork repository on my local
- Created
.env
file with DATABASE_URL environment variable filled (hosted on supabase) - Run
yarn build
,yarn update-db
even he did nothing - Add DATABASE_URL environment variable on netlify, deploy the site
@duboiss Looks like deploy works without pgbouncer=true
. Thanks! But sometimes on various requests I get an "Internal server error"
By various requests you mean when you navigate on the website one deployed on Netlify you have some errors ? Which page in particular ?
![Screenshot 2022-09-17 at 4 22 52 PM](https://user-images.githubusercontent.com/5698350/190859203-1d164705-25d4-4233-9d00-0c2384bb3bb8.png)
@duboiss On all pages there are different requests break. It's just that everything is unstable. After refreshing the page, they may start working, or others may break.
It looks like anytime the event table is hit, you're getting errors which makes me believe your 01 migration ran ok, but your 02 did not. Did you run any special commands to re-run your migrations after getting errors?
@briancao
Did you run any special commands to re-run your migrations after getting errors?
No
It looks like there's an issue w/ supabase not assigning table edit permissions to the login.
Please refer to Prisma/Supabase instructions to attain permission.
https://supabase.com/docs/guides/integrations/prisma#troubleshooting
@briancao I used the script but nothing changed. The problem persists. If I use pgbouncer=true
I get the same error in deployment. If I use clean url for DB I get 500 error
Can you re-post the error you're getting? Migrations shouldn't run alters if the previous migration failed w/o --rollbacks or --applied.
Just tried deploying and I'm getting the same error. :)
Try following https://github.com/umami-software/umami/discussions/1486#discussioncomment-3567397.
@rohandebsarkar It works! Thank you!