Giter Club home page Giter Club logo

Comments (12)

andrey59412678 avatar andrey59412678 commented on May 20, 2024 3

@Igosuki that works for me, just had to add quotes around user

however, there is still something missing: column "profile.team_owner". I had to remove from the query in the code to make it work

from lunary.

prazevj avatar prazevj commented on May 20, 2024 1

@Igosuki Thanks for suggesting "public"."app_user" table which is missing in setup_dump.sql table.
@andrey59412678 am also getting the same error in the web page (network tab) however I just created a column in profile table as team_owner as uuid() type and the error got fixed. But, am not sure about the data type and relation for this column.

Can anyone suggest a fix for this @vincelwt @pAkalpa ?

from lunary.

hughcrt avatar hughcrt commented on May 20, 2024 1

Hi @prazevj,

The correct table definition for profile is the following:

create table "public"."profile" (
	"id" uuid not null,
	"updated_at" timestamptz,
	"email" text,
	"name" text,
	"plan" text not null default 'free' ::text,
	"team_owner" uuid,
	constraint "profile_id_fkey1" foreign key ("id") references "auth"."users" ("id") on delete cascade,
	constraint "profile_id_fkey" foreign key ("id") references "auth"."users" ("id") on delete cascade,
	constraint "profile_team_owner_fkey" foreign key ("team_owner") references "public"."profile" ("id"),
	primary key ("id")
);

We'll make a cleaner database schema next week. We'll make sure to always keep setup-dump.sql after this. Sorry for the inconvenience!

from lunary.

pAkalpa avatar pAkalpa commented on May 20, 2024

@ninehills The commit e36e498 solved the issue. Please Update Repo and try again.

from lunary.

ninehills avatar ninehills commented on May 20, 2024

@ninehills The commit e36e498 solved the issue. Please Update Repo and try again.

I have already used the latest version, but it still gives that error.

from lunary.

pAkalpa avatar pAkalpa commented on May 20, 2024

@ninehills I apologize for suggesting that it was fixed in the first place. My mistake!. The error appears to be occurring at line number 144 in the setup-dump.sql file. This might be because the public.app_user table hasn't been created yet. You can check the specific code snippet here
@vincelwt @hughcrt any comments
Screenshot 2023-09-26 111641

from lunary.

Igosuki avatar Igosuki commented on May 20, 2024

This worked for me :


CREATE TABLE "public"."app_user" (
    "created_at" timestamptz DEFAULT now(),
    "app" uuid,
    "id" bigserial PRIMARY KEY,
    "external_id" text,
    "last_seen" timestamptz,
    "props" jsonb
);

CREATE POLICY app_user_owner_policy ON public.app_user USING ((( SELECT app.owner
   FROM public.app
  WHERE (app.id = app_user.app)) = auth.uid()));

ALTER TABLE public.run ADD COLUMN user bigint;

from lunary.

prazevj avatar prazevj commented on May 20, 2024

@hughcrt Thank you. It would be great if we can have a clear and cleaner self-host steps.

While using the self-hosted version in the callback handler code
res = requests.get(f"{self.__api_url}/api/app/{self.__app_id}")

this URL is giving me Internal Server Error. I tried changing the DEFAULT_API_URL and also have tried setting the LLMONITOR_API_URL, LLMONITOR_APP_ID. Unable to connect to the api endpoint. Any workaround or troubleshooting steps could you recommend ?

Note: Hosted on Supabase (Self-Host)

from lunary.

nkuehn avatar nkuehn commented on May 20, 2024

I can confirm the above issues (initial SQL not working, requires fixes discussed above) plus the following

  • email verification has localhost:3000 as redirect URL (vs. the vercel project URL - no documentation on where / how to tell the system its deployment URL). After manually changing the URL in the email, the redirect from there with ?code=.... has localhost:3000 in it again. -> needs to be set at https://supabase.com/dashboard/project/{your-project-id}/auth/url-configuration
  • 406 authentication failures from the frontend when calling supabase REST APIs. (even after deleting the user and all data in supabase and re-trying) - "JSON object requested, multiple (or no) rows returned"
  • frontend making various calls to llmonitor.featurebase.app which is does not really look like a self-deployed setup

I can help testing a new version but can't really help with development

from lunary.

vincelwt avatar vincelwt commented on May 20, 2024

Hi guys! Apologies about those issues, we're currently fully focused on fixing some core issues with the python module and feedback tracking and will work on improving self hosting as soon as we have a bit more time on our hand.

@nkuehn

  • Email verification endpoint is configured in Supabase I think? If you're self hosting supabase that would be in the Supaabse env variables
  • Not sure about the 406 errors, could you share screenshot of the console logs so we can try to pinpoint where they are?
  • Good call about llmonitor.featurebase.app, I'll disable those in the self hosted version

from lunary.

nkuehn avatar nkuehn commented on May 20, 2024

If you're self hosting supabase that would be in the Supaabse env variables

I can't see a related env var in the template - there's only the ones for resend.com

Not sure about the 406 errors, could you share screenshot of the console logs so we can try to pinpoint where they are?

This is the first one, all following fail the same way:

https://{my-tenant}.supabase.co/rest/v1/profile?select=id%2Cemail%2Cname%2Cupdated_at%2Cplan%2Cteam_owner&id=eq.6cfa5cd5-1413-4293-a1f5-1163e0423e26

Result is a 406, the body contains:

{
    "code": "PGRST116",
    "details": "The result contains 0 rows",
    "hint": null,
    "message": "JSON object requested, multiple (or no) rows returned"
}

My best guess is that the initialization with the first user is not working as intended. After resetting everything and retrying, in supabase there is an account under "authentication" but all the tables are still empty. So the initial setup click flow is not actually creating a user in llmonitor, just the supabase auth entry. My first guess is that is silently fails somewhere e.g. because the DB schema is not correct. my vercel logs are empty. For me: pausing this until there is a reliable DB schema setup script that does not make the app fail.

from lunary.

hughcrt avatar hughcrt commented on May 20, 2024

Hi,
We've fixed self hosting. It's been tested internally and by one of our users and it seems to work fine. Here are the instructions:

  1. Setup a new Supabase project (don't reuse the previous one, as the setup script will fail if the tables already exist).
  2. Clone the repo and deploy it to Vercel
  3. Look at .env.example to see what environment variables you need to set on Vercel
  4. Open the Supabase Admin dashboard
    4.1. Go to Database > Webhooks and click on "Enable webhooks"
    4.2. Copy the content of setup-dump.sql in the SQL editor. Replace <your_vercel_project_url> by the actual URL at the end of the script and run it.
    4.3. Go to Authentication > Url Configuration and replace http://localhost:3000 by your Vercel project url.

Please let me know if it works for you!
@ninehills @Igosuki @nkuehn @prazevj

from lunary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.