syntra / gatsby-remark-social-cards

Gatsby remark plugin for generating social card graphics
MIT License
95 stars 17 forks source link

When the plugin is used, excerpt generation fails #28

Open Shrivallabh opened 4 years ago

Shrivallabh commented 4 years ago

Hi,

I am pretty much using the default configuration as suggested in readme.

{
  resolve: 'gatsby-remark-social-cards',
  options: {
    title: {
      // This is the frontmatter field the title should come from
      field: "title",
      // Currently only supports DejaVuSansCondensed
      // More fonts coming soon!
      font: "DejaVuSansCondensed",
      color: "black", // black|white
      size: 48, // 16|24|32|48|64
      style: "bold", // normal|bold|italic
      x: null, // Will default to xMargin
      y: null, // Will default to yMargin
    },
    meta: {
      // The parts array is what generates the bottom text
      // Pass an array with strings and objects
      // The following array will generate:
      // "- Author Name » September 13"
      // The objects are used to pull data from your markdown's
      // frontmatter. { field: "author" } pulls the author set
      // in the frontmatter. { field: "category" } would pull
      // the category set. Any field can be used as parts
      // Note: Only pass the "format" property on date fields
      parts: [
        "- SomeComm",
        " » ",
        { field: "date", format: "mmmm dS" },
      ],
      // Currently only supports DejaVuSansCondensed
      // More fonts coming soon!
      font: "DejaVuSansCondensed",
      color: "black", // black|white
      size: 24, // 16|24|32|48|64
      style: "normal", // normal|bold|italic
      x: null, // Will default to xMargin
      y: null, // Will default to cardHeight - yMargin - size
    },
    background: "#FFFFFF", // Background color for the card
    xMargin: 24, // Edge margin used when x value is not set
    yMargin:  24,// Edge margin used when y value is not set
  }
},

If I try to fetch the excerpt using graphql I get the following error

{
  "message": "The \"path\" argument must be of type string. Received undefined",
  "locations": [
    {
      "line": 7,
      "column": 9
    }
  ],
  "path": [
    "allMarkdownRemark",
    "edges",
    1,
    "node",
    "excerpt"
  ],
  "stack": [
    "TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be of type string. Received undefined",
    "    at validateString (internal/validators.js:120:11)",
    "    at Object.join (path.js:375:7)",
    "    at module.exports (C:\\w\\myproject\\node_modules\\gatsby-remark-social-cards\\index.js:110:23)",
    "    at C:\\w\\myproject\\node_modules\\gatsby-transformer-remark\\extend-node-type.js:225:18",
    "From previous event:",
    "    at parseString (C:\\w\\myproject\\node_modules\\gatsby-transformer-remark\\extend-node-type.js:218:21)",
    "    at getMarkdownAST (C:\\w\\myproject\\node_modules\\gatsby-transformer-remark\\extend-node-type.js:270:14)",
    "    at runNextTicks (internal/process/task_queues.js:62:5)",
    "    at processImmediate (internal/timers.js:429:9)"
  ]
},

If I remove the plugin from configuration, the excerpt is generated fine. Is this a known issue?