mathieudutour / medium-to-own-blog

Switch from Medium to your own blog in a few minutes
MIT License
3.03k stars 107 forks source link

Deploy failed for drafts when 'date' field is empty. #37

Closed jsj14 closed 5 years ago

jsj14 commented 5 years ago
12:31:40 AM: Errors:
12:31:40 AM:   Expected Iterable, but did not find one for field Frontmatter.categories.
12:31:40 AM:   GraphQL request (18:7)
12:31:40 AM:   17:       description
12:31:40 AM:   18:       categories
12:31:40 AM:             ^
12:31:40 AM:   19:       date(formatString: "MMMM DD, YYYY")
12:31:40 AM: URL path:
12:31:40 AM:   /bla/
12:31:40 AM: Context:
12:31:40 AM:   {
12:31:40 AM:     "id": "b12058c6-e7b2-516b-b93c-9c534cf59d88",
12:31:40 AM:     "previous": null,
12:31:40 AM:     "next": null
12:31:40 AM:   }
12:31:40 AM: Plugin:
12:31:40 AM:   none
12:31:40 AM: Query:
12:31:40 AM:   query BlogPostQuery(
12:31:40 AM:     $id: String
12:31:40 AM:   ) {
12:31:40 AM:     site {
12:31:40 AM:       siteMetadata {
12:31:40 AM:         siteUrl
12:31:40 AM:         githubUrl
12:31:40 AM:       }
12:31:40 AM:     }
12:31:40 AM:     mdx(id: {eq: $id}) {
12:31:40 AM:       fields {
12:31:40 AM:         slug
12:31:40 AM:       }
12:31:40 AM:       timeToRead
12:31:40 AM:       frontmatter {
12:31:40 AM:         title
12:31:40 AM:         description
12:31:44 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
12:31:40 AM:         categories
12:31:40 AM:         date(formatString: "MMMM DD, YYYY")
12:31:44 AM: Shutting down logging, 24 messages pending

To Reproduce Steps to reproduce the behavior:

  1. Create a draft as per the docs, keeping empty date fields, and published: false
  2. commit to github
  3. netlify tries to auto-deploy
  4. check deploy logs to find the above error

Screenshots If applicable, add screenshots to help explain your problem.

Additional context I didn't try this with fixing the first part - i.e. filling the categories and keeping just the date field empty. will update this issue on trying that.

mathieudutour commented 5 years ago

So I think that's already fixed. Could you try copy pasting this file: https://github.com/mathieudutour/medium-to-own-blog/blob/master/gatsby-template/gatsby-node.js?

jsj14 commented 5 years ago

Yes! it worked with empty date and string. https://github.com/jsj14/random/blob/master/content/cached-and-forgotten/index.md

Thanks.