montevideo-tech / hybrid-meetup-platform

Summer Camp WebRTC challenge. This project can be used to host and run hybrid meetups for the video community. Built by video-dev for video-devs 💚
Apache License 2.0
5 stars 2 forks source link

Setup a local instance of the Supabase backend for backend development purposes. #197

Open felipeYoungi opened 1 year ago

felipeYoungi commented 1 year ago

As a development team, we need to have a local instance of the Supabase backend set up so we can work on the backend code without affecting the production environment. This will allow us to test new features, make changes, and debug issues in a controlled environment before deploying to production.

felipeYoungi commented 1 year ago

We are going to leave this for the second part of the sprint.

JonaQuaLabs commented 1 year ago

This documentation could be helpful for this issue. https://supabase.com/docs/guides/functions/local-development#running-edge-functions-locally

yulianag-qualabs commented 1 year ago

When trying to start the local instance of Supabase by running "supabase start" command, the following error occurs:

Error: ERROR: must be a member of role "supabase_admin" (SQLSTATE 42501)

This is because tables created through the Supabase dashboard are owned by the "supabase_admin" role, while the migration scripts executed through the CLI are under the "postgres" role.

Previously, this issue could be resolved by changing the user to a superuser in PostgreSQL using either of the following commands:

__GRANT supabaseadmin TO postgres; _ALTER ROLE postgres with SUPERUSER;__

However, Supabase has recently updated its policies, and the suggested solution in the documentation is to reassign the owner of those tables to the "postgres" role. This was attempted by executing the following commands in the SQL editor for each table, but it did not work:

ALTER TABLE roles OWNER TO postgres; ALTER TABLE rooms OWNER TO postgres; ALTER TABLE "rooms-data" OWNER TO postgres; ALTER TABLE "rooms-permission" OWNER TO postgres; ALTER TABLE "users-data" OWNER TO postgres; ALTER TABLE "message-chat" OWNER TO postgres;

References:

Supabase documentation:

Supabase discussion on policy changes: