© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
7 replies
justAbajit

Could not find a relationship in the schema cache

Here's the query I want to run

SELECT project_members.user_id, users_lookup.email, users_lookup.first_name, users_lookup.last_name
FROM project_members
INNER JOIN users_lookup
ON project_members.user_id = users_lookup.user_id
WHERE project_members.project_id = 'abcdefgh';

This query runs perfectly in the SQL editor in supabase. Now i want to run the same query through javascript. I'm following the documentation to the write this query in javascript

const { data, error } = await supabase
.from("project_members")
.select(
user_id,users_lookup!inner(first_name, last_name, email)
user_id,users_lookup!inner(first_name, last_name, email)
)
.eq("project_id",
project_id
).eq("users_lookup.user_id", "project_members.user_id");

This join needs to select the data from the users_lookup table where the user_id from the project_members table matches with the user_id in the users_lookup table and also the project_id should match the id in project_id variable so essentially I'm selecting members from the table who's project_id matches the one given and then for those users I'm using the user_id to get the respective data from the users_lookup table

When I try to run this I'm getting this error

Could not find a relationship between 'project_members' and 'users_lookup' in the schema cache
image.png
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Could not find a relationship between 'messages' and 'user' in the schema cache
SupabaseSSupabase / help-and-questions
14mo ago
Could not find a relationship between 'ev_opportunities' and 'sportsbooks' in the schema cache
SupabaseSSupabase / help-and-questions
3mo ago
Persistent Schema Cache Error: "Could not find a relationship" despite correct Foreign Key
SupabaseSSupabase / help-and-questions
5mo ago
Could not find a relationship between 'lists' and 'creator'
SupabaseSSupabase / help-and-questions
4y ago