gatsbyjs/gatsby-source-wordpress-experimental

Error occurred while fetching "MediaItem" nodes in inline html

Closed this issue · 8 comments

This is version 0.7.3. It fails on both production and development when trying to pull MediaItems.
Here is the log:

success  gatsby-source-wordpress  writing GraphQL queries to disk at ./WordPress/GraphQL/ - 0.127s
success  gatsby-source-wordpress  ingest WPGraphQL schema - 1.631s
success createSchemaCustomization - 2.890s
success  gatsby-source-wordpress  Comment - 0.035s - fetched 0
success  gatsby-source-wordpress  fetch root fields - 0.547s
success  gatsby-source-wordpress  Menu - 0.546s - fetched 1
success  gatsby-source-wordpress  UserRole - 0.531s - fetched 0
success  gatsby-source-wordpress  MenuItem - 0.579s - fetched 7
success  gatsby-source-wordpress  PostFormat - 0.576s - fetched 0
success  gatsby-source-wordpress  Taxonomy - 0.625s - fetched 3
success  gatsby-source-wordpress  Post - 0.809s - fetched 10
success  gatsby-source-wordpress  ContentType - 0.831s - fetched 3
success  gatsby-source-wordpress  User - 0.853s - fetched 2
success  gatsby-source-wordpress  Category - 1.640s - fetched 6
success  gatsby-source-wordpress  Page - 5.851s - fetched 259
success  gatsby-source-wordpress  Tag - 5.973s - fetched 264

 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_5


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_6


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_7


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_8


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_9

info  gatsby-source-wordpress  GraphQL vars: {"first":100,"after":null}

 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_6


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_7


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_8


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_9


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_10


 ERROR

 gatsby-source-wordpress  Error category: undefined

Error:
  Internal server error

 Debug message:
  Call to a member function then() on null

 Error path: mediaItem__index_11

info  gatsby-source-wordpress  GraphQL vars: {"first":100,"after":null}

 ERROR #gatsby-source-wordpress-experimental_111002

 gatsby-source-wordpress  Error occurred while fetching "MediaItem" nodes in inline html.

What I have tried, with no success:

  • excluding MediaItems (can't do that)
  • limiting Posts
  • limiting Pages
  • clearing cache etc

In addition, running WordPress/GraphQL/MediaItem/node-list-query.graphql query on GraphiQL on Wordpress runs fine.

Update: this works if I bypass the createScaledImageUrl function:

const createScaledImageUrl = url => {
  return url // ******* bypass for now ******* 
  const fileExtension = urlToFileExtension(url);
  const isAlreadyScaled = url.includes(`-scaled${fileExtension || ``}`);

  if (isAlreadyScaled) {
    return url;
  }

  let scaledUrl;

  if (fileExtension) {
    scaledUrl = url.replace(fileExtension, `-scaled${fileExtension}`);
  } else {
    scaledUrl = `${url}-scaled`;
  }

  return scaledUrl;
};

Hi @Kallirroi , can you share the output of gatsby info? Which plugin is on 0.7.3?

Sure - sorry for not clarifying, gatsby-source-wordpress-experimental is on 0.7.3, WP Gatsby is on 0.9.2.

Output of gatsby info:

  System:
    OS: macOS 11.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.18.4 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.5.2 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 88.0.4324.146
    Firefox: 84.0.2
    Safari: 14.0.2
  npmPackages:
    gatsby: ^2.24.1 => 2.32.0
    gatsby-cli: ^2.12.61 => 2.19.0
    gatsby-image: ^2.4.7 => 2.11.0
    gatsby-plugin-breakpoints: ^1.2.2 => 1.3.2
    gatsby-plugin-manifest: ^2.11.0 => 2.12.0
    gatsby-plugin-modal-routing: ^1.2.0 => 1.2.0
    gatsby-plugin-netlify: ^2.3.13 => 2.11.0
    gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0
    gatsby-plugin-netlify-redirect: ^1.0.0 => 1.0.0
    gatsby-plugin-offline: ^3.2.11 => 3.10.0
    gatsby-plugin-react-helmet: ^3.3.4 => 3.10.0
    gatsby-plugin-react-svg: ^3.0.0 => 3.0.0
    gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
    gatsby-plugin-sharp: ^2.13.4 => 2.14.0
    gatsby-recipes: ^0.2.16 => 0.2.38
    gatsby-remark-social-cards: ^0.4.1 => 0.4.1
    gatsby-source-filesystem: ^2.3.11 => 2.11.0
    gatsby-source-wordpress: ^3.10.0 => 3.11.0
    gatsby-source-wordpress-experimental: ^7.0.4 => 7.0.4
    gatsby-transformer-remark: ^2.8.35 => 2.16.0
    gatsby-transformer-sharp: ^2.11.0 => 2.12.0
  npmGlobalPackages:
    gatsby-cli: 2.19.0

The errors being returned are coming from WPGraphQL. I'd recommend upgrading to the latest version of WPGQL and if the problem persists open an issue on the WPGQL repo 👍

 Debug message:
  Call to a member function then() on null

That's an internal WPGQL error

I see - I thought it was an experimental error since it seems to bug with specific images (there might be an issue with images that can't be fetched from WP?), and besides the GraphQL query runs fine on WP's Graphiql.

I will poke around their repo, thanks.

It likely happens while querying for a specific field on a specific image. then() is a PHP thing :) If you enable showQueryOnError it could help here https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/blob/master/docs/plugin-options.md#debuggraphqlshowqueryonerror

Closing this issue for now since we need WPGraphQL to address this bug. Unfortunately, there isn't anything we can implement in Gatsby that would fix this issue.

Hey @jacksellwood - is there any progress on WPGraphQL-side on this? Should I ticket on their repo? Thanks!