Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby-plugin-netlify]: Wrong shape for headers #2797

Closed
iiroj opened this issue Nov 5, 2017 · 7 comments
Closed

[gatsby-plugin-netlify]: Wrong shape for headers #2797

iiroj opened this issue Nov 5, 2017 · 7 comments

Comments

@iiroj
Copy link

iiroj commented Nov 5, 2017

Error: The "headers" option to gatsby-plugin-netlify is in the wrong shape. Yo u should pass in a object with string keys (representing the paths) and an array of strings as the value (representing the headers). Check your gatsby-config.js.

For whatever reason, lately my generation of Netlify headers has stopped working, while it was working before. This started after updating Node and packages; related commit here:
iiroj/iiro.fi@213268a

Removing headers: {...} from the config works, and there's no problem with allheaders: [...].

For reference, my headers were as follows:
iiroj/iiro.fi@021cdfb

EDIT: Building my current release on Node 8.6.0 also produces this error, so it's not related directly to Node 8.9.0

@KyleAMathews
Copy link
Contributor

Not super familiar with how gatsby-plugin-netlify works. Could you dive into the code a bit to see why things are breaking?

@ungarida
Copy link

ungarida commented Nov 7, 2017

I did an update of my package and I get as well:

error Plugin gatsby-plugin-netlify returned an error
Error: The "headers" option to gatsby-plugin-netlify is in the wrong shape. You should pass in a object with string keys (representing the paths) and an array of strings as the value (representing the headers). Check your gatsby-config. js.

@iiroj
Copy link
Author

iiroj commented Nov 7, 2017

Well, it seems gatsby-plugin-netlify doens't receive the headers object correctly:

{ '/': 
   [ 'Link: </d.svg>; rel=preload; as=image',
     'Link: </e.svg>; rel=preload; as=image',
     'Link: </gh.svg>; rel=preload; as=image',
     'Link: </gl.svg>; rel=preload; as=image',
     'Link: </l.svg>; rel=preload; as=image',
     'Link: </t.svg>; rel=preload; as=image',
     _PARENT: 'SOURCE' ],
  _PARENT: 'SOURCE' }

It fails to this _PARENT: 'SOURCE' key val on the last line. I haven't seen anything like this before but I'll keep digging. The plugin uses lodash heavily, so maybe it comes from there.

@KyleAMathews
Copy link
Contributor

Ugh that again. There's a PR fixing this at #2812

@KyleAMathews
Copy link
Contributor

I'll be merging and releasing it soon

@KyleAMathews
Copy link
Contributor

This should be fixed now in the most recent release — would love to hear a report back.

@iiroj
Copy link
Author

iiroj commented Nov 7, 2017

It is again working as expected! Thanks!

This was referenced Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants