nextjs-edgedb-auth-template icon indicating copy to clipboard operation
nextjs-edgedb-auth-template copied to clipboard

Error: required link 'created_by' of object type 'default::Item' hidden by access policy

Open stemil23 opened this issue 1 year ago • 1 comments

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
      }
    };
  `); 

Cursor_and_localhost_3000_dashboard EdgeDB___EdgeDB_Auth___Next_js_Template nextjs_edgedb_auth_template_main___main___EdgeDB_Local-2 nextjs_edgedb_auth_template_main___main___EdgeDB_Local

stemil23 avatar Oct 19 '24 21:10 stemil23

yes, it's a problem, The user's access policy should indeed be slightly modified.

lonexw avatar Mar 04 '25 09:03 lonexw