nextjs-edgedb-auth-template
nextjs-edgedb-auth-template copied to clipboard
Error: required link 'created_by' of object type 'default::Item' hidden by access policy
When testing with two (or more) users with each having created ToDo items the dashboard errors. I believe the schema lines 40, 41 are the cause.
access policy everyone_insert_only
allow insert;
As when "select" is added to line 41 the defect is eliminated.
access policy everyone_insert_only
allow insert, select;
It seem that the Select Query on dashboard/page is the cause of this defect as removing "created by" (lines 17-20) eliminates the error:
const items = await client.query<Props["items"][number]>(`
select Item {
id,
name,
created,
updated,
created_by: {
name,
email
}
};
`);
yes, it's a problem, The user's access policy should indeed be slightly modified.