directus-labs / directus-templates

Community maintained templates to jump start your Directus project
37 stars 8 forks source link

Multiple warnings about "policy" field validation in Directus v11 #3

Open paulrudy opened 1 month ago

paulrudy commented 1 month ago

Installing the website-cms template on a fresh deployment of Directus v11 causes errors regarding policy field validation.

Steps to reproduce

Basically, follow the instructions on the README for this repo using Directus's v11 (latest as of this writing). In summary:

  1. Deploy using the latest Directus image (v11.x) directus/directus:latest
  2. Create an Admin static token
  3. Open a shell in the app and npx directus-template-cli@latest apply
  4. Choose official templates (maybe it's called community templates)
  5. Choose Headless CMS template

Outcome: 250 warnings: Warning: Status 400 • "Validation failed for field \"policy\". Value is required." like this:

...
Loading translations... done
Loaded translations
 ›   Warning: Status 400 • "Validation failed for field \"policy\". Value is required."

<<n=250 of the above warning>>

Loading 267 permissions... done
Loaded permissions
------------------
Template applied successfully.

Note that the template did install successfully. I didn't immediately find any issue with the Directus app and the installed template afterwards, so it's possible that the warnings weren't important, but I have no way of knowing.

Installing on Directus v10 produces no such warnings. I'm assuming this has to do with Directus v11 introducing policies. Perhaps the template(s) need to be updated? It's also unclear whether these warnings can be safely ignored.

SN3-K commented 1 month ago

@paulrudy , try to purge your directus instance and re create a new database.

My Team is not currently experiencing this in our directus deployments ( EC2 + Postgres ).

I am wondering if something just got out of whack with your instance.

paulrudy commented 1 month ago

@paulrudy , try to purge your directus instance and re create a new database.

My Team is not currently experiencing this in our directus deployments ( EC2 + Postgres ).

I am wondering if something just got out of whack with your instance.

Thanks for the reply. I think this has something to do with the repo not being updated for the policies introduced in v11.

I ran into this issue on a brand new database running Directus v11. When I created a new Directus running v10, there were no warnings. Upgrading from v10 to v11 presented no issues.

I got feedback on Directus Discord:

Just confirming - The templates will need to be updated to support v11 correctly

SN3-K commented 1 month ago

Interesting, so this issue occurred when you deployed directly from v11, but when deploying from v10 , then upgrading to v11 this issue is resolved? @paulrudy

SN3-K commented 1 month ago

Can you edit this issue to include all steps to reproduce the bug?

paulrudy commented 1 month ago

Interesting, so this issue occurred when you deployed directly from v11, but when deploying from v10 , then upgrading to v11 this issue is resolved? @paulrudy

Yes, exactly. Or at least, there is no indication of any problem when upgrading.

Can you edit this issue to include all steps to reproduce the bug?

The steps are essentially following the README of this repo while using a fresh deploy of Directus v11, but I've added them for clarity.

SN3-K commented 1 month ago

This is actually covered here:

https://github.com/directus-labs/directus-template-cli/issues/61 @paulrudy