Chris Haupt
Chris Haupt

Reputation: 152

Deploying on Netlify throws an error with my GraphQL/Gatsby/Contentful query, demands needless query parameter

At first I was getting this error on my local build server, but I managed to fix it there... the query is still the same, but gatsby isn't throwing any errors with the query. But every time I try to deploy on Netlify it fails with the following message:

toFormat seems to be empty, we need a fileExtension to set it.
    1 | fragment GatsbyContentfulFluid_tracedSVG on ContentfulFluid {
 >  2 |   tracedSVG
      |   ^
    3 |   aspectRatio
    4 |   src
    5 |   srcSet
    6 |   sizes
    7 | }
 failed during stage 'building site': Build script returned non-zero exit code: 1
    8 |
    9 | query optbuildreposrccomponentsshopProductsJs2136335468 {
   10 |   products: allContentfulProduct {
   11 |     edges {
   12 |       node {
 Shutting down logging, 22 messages pending
 File path: /opt/build/repo/src/components/shop/Products.js
 Plugin: none

This is the same error I was getting locally and I have no idea why it is occurring. There should be no reason that toFormat is a required parameter. This is using the standard gatsby-source-contentful plugin API request which has always served the image without issue in the past. If I change the request to 'fixed' instead of 'fluid' the problem goes away, but I need fluid images for this part of the site.

I emailed the Netlify staff a few days ago, but am yet to receive a reply. Any help would be greatly appreciated.

Upvotes: 1

Views: 679

Answers (2)

rodguima
rodguima

Reputation: 61

For Those who are facing the same issue I came up with a simple solution.

  1. Remove from all your file places that you used this extension _tracedSVG.

eg.

GatsbyContentfulFixed_tracedSVG 

to

GatsbyContentfulFixed
  1. Stop your gatsby server and use the follow command:

    gatsby clean && gatsby develop

  2. Commit and push your changes (in case you are using Github)

  3. On Netlify find the option: Clear cache and deploy site

It should fix your Deployment on Netlify as well errors on your console :)

Upvotes: 3

Jay Cuthrell
Jay Cuthrell

Reputation: 11

Two suggestions:

  1. Local: Double check your content for any image references that do not append a suffix of .png or .jpg
  2. Netlify: Clear cache and deploy site

Upvotes: 1

Related Questions