Home
Support Forums

Mtime graphql query in Gatsby causes Netlify build to hang

For the past year, we’ve been using mtime in our graphql query to generate “last modified” time for our sitemaps. Like so:

query MyQuery {
  allMdx {
    nodes{
    parent {
                ... on File {
                  mtime
                }
              }
    }
  }
}

This has never been an issue with Netlify until very recently (a week or two ago).

Now, Netlify hangs at onPostBuild and times out after an hour with an exceeded time error.

The exact same query works fine on our localhost Ubuntu setup, so I can’t understand why it’s causing issues with Netlify. Gatsby Cloud also builds it fine.

Must be a limitation with the Ubuntu image that Netlify uses?

Can anyone advise here?

EDIT: My other thought was maybe there’s a security issue using the fs module for mtime that Netlify has disabled?

Hey there, @donovan :wave:

Thanks so much for reaching out about this. Would you mind sharing which site this is happening with? Additionally, can you share which version of Ubuntu you are using?

Thank you!

Hi @Donovan,

I don’t think using mtime is reliable. Git doesn’t store last modified time, so I think it will show the same time for all files as we clone them together.

I did some digging and found this:

I think it’s worth considering some alternatives.