{"action":"created","issue":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/8620","repository_url":"https://api.github.com/repos/gatsbyjs/gatsby","labels_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/8620/labels{/name}","comments_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/8620/comments","events_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/8620/events","html_url":"https://github.com/gatsbyjs/gatsby/pull/8620","id":364949142,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MDE0NDQ1","number":8620,"title":"DO-NOT-MERGE Feed plugin sanitation","user":{"login":"millette","id":50741,"node_id":"MDQ6VXNlcjUwNzQx","avatar_url":"https://avatars1.githubusercontent.com/u/50741?v=4","gravatar_id":"","url":"https://api.github.com/users/millette","html_url":"https://github.com/millette","followers_url":"https://api.github.com/users/millette/followers","following_url":"https://api.github.com/users/millette/following{/other_user}","gists_url":"https://api.github.com/users/millette/gists{/gist_id}","starred_url":"https://api.github.com/users/millette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/millette/subscriptions","organizations_url":"https://api.github.com/users/millette/orgs","repos_url":"https://api.github.com/users/millette/repos","events_url":"https://api.github.com/users/millette/events{/privacy}","received_events_url":"https://api.github.com/users/millette/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-09-28T15:59:20Z","updated_at":"2018-10-03T00:36:37Z","closed_at":"2018-10-02T14:30:02Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/pulls/8620","html_url":"https://github.com/gatsbyjs/gatsby/pull/8620","diff_url":"https://github.com/gatsbyjs/gatsby/pull/8620.diff","patch_url":"https://github.com/gatsbyjs/gatsby/pull/8620.patch"},"body":"I couln't make the feed plugin work until I finally understood the reason. I had an object in ```siteMetadata``` instead of a string or a number.\r\n\r\nIt was failing with this error:\r\n```\r\nerror Plugin gatsby-plugin-feed returned an error\r\n\r\n\r\n  TypeError: Cannot convert object to primitive value\r\n  \r\n  - xml.js:177 resolve\r\n    [gatsby-starter-location-github]/[xml]/lib/xml.js:177:34\r\n  \r\n  - xml.js:191 \r\n    [gatsby-starter-location-github]/[xml]/lib/xml.js:191:42\r\n  \r\n  - Array.forEach\r\n  \r\n  - xml.js:184 resolve\r\n    [gatsby-starter-location-github]/[xml]/lib/xml.js:184:24\r\n  \r\n  - xml.js:191 \r\n    [gatsby-starter-location-github]/[xml]/lib/xml.js:191:42\r\n  \r\n  - Array.forEach\r\n  \r\n  - xml.js:184 resolve\r\n    [gatsby-starter-location-github]/[xml]/lib/xml.js:184:24\r\n  \r\n  - xml.js:47 add\r\n    [gatsby-starter-location-github]/[xml]/lib/xml.js:47:24\r\n  \r\n  - xml.js:89 xml\r\n    [gatsby-starter-location-github]/[xml]/lib/xml.js:89:9\r\n  \r\n  - index.js:185 RSS.xml\r\n    [gatsby-starter-location-github]/[rss]/lib/index.js:185:13\r\n  \r\n  - gatsby-node.js:151 _loop$\r\n    [gatsby-starter-location-github]/[gatsby-plugin-feed]/gatsby-node.js:151    :73\r\n```  \r\n\r\nAll I had to do to fix it was to remove that object from my feed query configuration and thought maybe this could help someone else. The patch simply removes any value under ```siteMetadata``` that isn't a string or a number, and also converts numbers to strings (for use in the rss feed).\r\n\r\nFeel free to merge or not. If not, maybe we could add a bit of documentation about that.\r\n\r\n<!--\r\n  Q. Which branch should I use for my pull request?\r\n  A. Use `master` branch (probably).\r\n\r\n  Q. Which branch if my change is a bug fix for Gatsby v1?\r\n  A. In this case, you should use the `v1` branch\r\n\r\n  Q. Which branch if I'm still not sure?\r\n  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)\r\n\r\n  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.\r\n\r\n  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/\r\n-->\r\n"},"comment":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/comments/426475500","html_url":"https://github.com/gatsbyjs/gatsby/pull/8620#issuecomment-426475500","issue_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/8620","id":426475500,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjQ3NTUwMA==","user":{"login":"pieh","id":419821,"node_id":"MDQ6VXNlcjQxOTgyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/419821?v=4","gravatar_id":"","url":"https://api.github.com/users/pieh","html_url":"https://github.com/pieh","followers_url":"https://api.github.com/users/pieh/followers","following_url":"https://api.github.com/users/pieh/following{/other_user}","gists_url":"https://api.github.com/users/pieh/gists{/gist_id}","starred_url":"https://api.github.com/users/pieh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pieh/subscriptions","organizations_url":"https://api.github.com/users/pieh/orgs","repos_url":"https://api.github.com/users/pieh/repos","events_url":"https://api.github.com/users/pieh/events{/privacy}","received_events_url":"https://api.github.com/users/pieh/received_events","type":"User","site_admin":false},"created_at":"2018-10-03T00:36:37Z","updated_at":"2018-10-03T00:36:37Z","author_association":"CONTRIBUTOR","body":"@secretfader I did re-read your comments (again) but until your last one it still wasn't clear to me so thank You for clarifying things.\r\n\r\n> If the underlying RSS generator has issues parsing configuration _other than strings and numbers_, it's the users' job to translate their custom configuration into a format it can accept using the `setup` callback.\r\n\r\nIf users need custom `setup` function, we could probably improve DX by catching those scenarios and providing more meaningful feedback (like what should they adjust in gatsby-config). If we could run setup and serialize part before we even interact with `rss` object we could see if any of feed items would contain plain objects / supported fields by `rss` package and we could warn users about it - is this correct?\r\n\r\n> Every attempt has ended up failing because this plugin is widely used, across many cases, and difficult to simplify without breaking many builds across the community.\r\n\r\nIf you have ideas how plugin can be improved that need breaking changes for users we can always bump major version to do this - it's not ideal but if it needs to be done, then it needs to be done.\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"pieh"}}