Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Build failure: "Sorry, you do not have permission to view this setting." allSettings.generalSettingsEmail, generalSettings.email #139

Closed

Description

@etnichols

gatsby-source-wordpress-experimental: 1.3.6

Using WP GraphQL plugin version 0.10.3

Relevant build output:

success  gatsby-source-wordpress  MediaItem - 123.668s - fetched 105
success  gatsby-source-wordpress  creating nodes - 123.720s
success  gatsby-source-wordpress  fetching nodes - 150.355s - 291 total

 ERROR

 gatsby-source-wordpress  (undefined) location: line 9, column: 5
	 Sorry, you do not have permission to view this setting.

 Error path: allSettings.generalSettingsEmail

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  (undefined) location: line 34, column: 5
	 Sorry, you do not have permission to view this setting.

 Error path: generalSettings.email

 If you haven't already, try adding define( 'GRAPHQL_DEBUG', true ); to your wp-config.php for more detailed error messages.


 ERROR

 gatsby-source-wordpress  Error occured while fetching non-Node root fields.

not finished source and transform nodes - 151.951s
not finished Downloading remote files - 35.117s
not finished Generating image thumbnails - 122.007s
not finished  gatsby-source-wordpress  fetch root fields - 1.397s

(sharp:69783): GLib-CRITICAL **: 16:03:27.305: g_hash_table_lookup: assertion 'hash_table != NULL' failed

Digging into this error message led me to this WP Graphql discussion: wp-graphql/wp-graphql#373. Which was formalized into https://docs.wpgraphql.com/guides/authentication-and-authorization/. Very helpful!

The relevant part of the docs:

A public, non-authenticated request would return a null value for the field and would return an error message in the GraphQL response. However, it wouldn’t block the execution of the entire GraphQL request, just that field. So, if the request had a mix of publicly allowed fields and private fields, GraphQL would still execute the public data.

Which leads to my questions:

  • Why are the allSettings.generalSettingsEmail and generalSettings.email actually necessary for the build process?
  • If part of a larger query, shouldn't this query actually be succeeding and just leaving those fields blank?

Activity

  1. etnichols commented on Aug 25, 2020

    @etnichols
    Author

    @jasonbahl -- could you provide more guidance on how to actually use the wp-graphql plugin with the authentication plugins you mention in the documentation?

  2. etnichols commented on Aug 26, 2020

    @etnichols
    Author

    Workaround:

        {
          resolve: `gatsby-source-wordpress-experimental`,
          options: {
             AllSettings: {
               excludeFieldNames: ['generalSettingsEmail'],
             },
             GeneralSettings: {
               excludeFieldNames: ['email'],
             },
           },
        },
    

    To bypass the auth-only fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions