edgedb / nextjs-edgedb-auth-template

A minimal starter designed to help you get up and running with EdgeDB and Next.js quickly. It includes a basic setup for authentication, EdgeDB schema, and a UI to get you started.
https://nextjs-edgedb-auth-template-kappa.vercel.app
30 stars 8 forks source link

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

Open stemil23 opened 4 weeks ago

stemil23 commented 4 weeks ago

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