Gatsby-source-wordpress-experimental: fetching nodes times out on large files

Created on 24 Jun 2020  路  11Comments  路  Source: gatsbyjs/gatsby-source-wordpress-experimental

Hello @TylerBarnes! I'm trying to use this new source plugin (looks amazing!) - but it seems to hang on video media files. I'm not sure if it's my server, but is there a way I can ignore them since they won't be processed by gatsby like the images are?

enhancement todo after v4 release upstream

Most helpful comment

@joperron upgrade to [email protected] for the excludeByMimeTypes option. Thanks for opening this issue! This is really good to know about 馃憤 I'll comment here once fileSize is added as well.

All 11 comments

@joperron if it's trying to process them now I'll need to update the source plugin internally, nothing you can change to make that work right now. I'll try to reproduce today and fix it but if you have a reproduction /graphql API I can use that would be helpful!

Ahh, it's actually because you have huge video files and it times out downloading them. I'm investigating some solutions and/or workarounds for this now

I figured that might be it - just deleted the videos to give it another run so if you see it working it's not a sudden miracle!

@joperron I'm working on a release that adds a way to prevent fetching files by mime type.

I'm thinking of adding something like this to plugin options:

{
  options: {
    type: {
      MediaItem: {
          localFile: {
              excludeByMimeTypes: [`video/mp4`],
          },
      },
    }
  }
}

Once we can query the file size, I'll have a default max file size that's configurable

Looks good to me, that's what I was imagining as a stopgap, and the fileSize of course would be amazing!

@joperron upgrade to [email protected] for the excludeByMimeTypes option. Thanks for opening this issue! This is really good to know about 馃憤 I'll comment here once fileSize is added as well.

Thank you Tyler!

FYI this fileSize field has been merged into WPGraphQL and we're just waiting on a new release 馃憤

That's huge! No pun intended

The options.type.MediaItem.localFile.maxFileSizeBytes option was added a couple weeks ago and is set to by default exclude media item files that are over 15Mb. https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/blob/master/docs/plugin-options.md#typemediaitemlocalfilemaxfilesizebytes-number

Update to the latest version of the plugin to use it :)

Was this page helpful?
0 / 5 - 0 ratings