Cms: Not able to configure public GraphQL schema via yaml configuration (Craft 3.5)

Created on 22 Jul 2020  路  4Comments  路  Source: craftcms/cms

Description

We aren't able to configure a public schema for GraphQL via the yaml configuration files.
This was reported earlier in this issue: https://github.com/craftcms/cms/issues/6078 and closed because it should be fixed in the 3.5 release.
We upgraded to 3.5 RC1.1 but the issue still persists.

Steps to reproduce

  1. Enable and configure the GraphQL public scheme on your local development environment (separate database, allowAdminChanges on true)
  2. See the new yaml file appear in config/project/graphql/schemas with the isPublic flag on true.
  3. Rollout these changes to the staging/production environment (separate databse, allowAdminChanges on false).
  4. Try to do a request to the GraphQL API without sending an authorization header (because it's a public schema).
  5. See you get a 400 Bad Request error with the message Missing Authorization header
  6. Run craft graphql/print-schema on the staging/production environment
  7. See the following error message: No public schema exists, and one can鈥檛 be created because allowAdminChanges is disabled.

Additional info

  • Craft version: 3.5 RC1.1
  • PHP version: 7.4.2
  • Database driver & version: PostgreSQL 12
  • Plugins & versions: Azure Blob Remote Volume 1.0.2, Embedded Assets 2.3.1, Redactor 2.6.1
bug normal

All 4 comments

Ah, sorry about that! Just pushed a fix for the next 3.5 release!

Craft 3.5 RC2 is out now with that fix.

@andris-sevcenko @brandonkelly Thank you for looking into this!
I've updated to RC2 (and also tested on the 3.5 branch), but the issue doesn't seem to be resolved.
I get the same result. I already re-generated the GraphQL schema but that's not changing anything. Do I need to do anything else?

@TrafeX you can fix this by running project-config/apply --force. This is because, before the fix, the public token settings were not created and/or attached to the public schema, if no such link existed. However, Craft thought everything was fine and dandy with GraphQL public schema settings. By running project-config/apply with the --force setting, you're telling Craft to treat everything in the project config files as an incoming change and trigger re-saving for everything, including the public schema settings.

Sorry for the run-around!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

angrybrad picture angrybrad  路  3Comments

benface picture benface  路  3Comments

angrybrad picture angrybrad  路  3Comments

davist11 picture davist11  路  3Comments

darylknight picture darylknight  路  3Comments