Installing Ghost on Ubuntu with Gatsby API error


#1

Hello all!

I’m having some trouble understanding how exactly to get Gatsby playing nicely with Ghost?

  • I have Ghost (latest) running on Ubuntu 18.04.01 here https://lucasjohnson.co.nz, installed using this tutorial: https://docs.ghost.org/install/ubuntu/
  • In the Ghost admin I’ve created a custom Integration to generate a Content API Key (no webhooks configured)
  • Installed the Gatsby starter repo locally from here: https://github.com/TryGhost/gatsby-starter-ghost
  • Updated the .ghost.json file like so:
{
  "development": {
    "apiUrl": "https://lucasjohnson.co.nz",
    "contentApiKey": "ghostadminapikey"
  },
  "production": {
    "apiUrl": "https://lucasjohnson.co.nz",
    "contentApiKey": "ghostadminapikey"
  }
}

This breaks my Gatsby local install.

I get the following error in Terminal:

warning The GraphQL query in the non-page component "/Users/lucasjohnson/Sites/lucasjohnson.co.nz/src/templates/author.js" will not be run.
warning The GraphQL query in the non-page component "/Users/lucasjohnson/Sites/lucasjohnson.co.nz/src/templates/index.js" will not be run.
warning The GraphQL query in the non-page component "/Users/lucasjohnson/Sites/lucasjohnson.co.nz/src/templates/page.js" will not be run.
warning The GraphQL query in the non-page component "/Users/lucasjohnson/Sites/lucasjohnson.co.nz/src/templates/post.js" will not be run.
warning The GraphQL query in the non-page component "/Users/lucasjohnson/Sites/lucasjohnson.co.nz/src/templates/tag.js" will not be run.

This error at http://localhost:8000/___graphql:

{
  "errors": [
    {
      "message": "Syntax Error: Unexpected <EOF>",
      "locations": [
        {
          "line": 30,
          "column": 1
        }
      ]
    }
  ]
}

And this is a screenshot of site error:

I apologize if this is an obviously solve, but I am new to this :confused:

I’m I missing the Gatsby plugin running on my server?

Thanks in advance!


#2

Hey @lucasjohnson

Your build is not broken. There’s just nothing to show for Gatsby. Warnings like this

warning The GraphQL query in the non-page component "/Users/lucasjohnson/Sites/lucasjohnson.co.nz/src/templates/author.js" will not be run.

mean that Gatsby wasn’t able to fetch any data from your Ghost instance. When I visit your URL https://lucasjohnson.co.nz I can see that it’s completely empty, hence Gatsby is not able to query anything.

You need to add some data in order to fetch it with the Content API.

Let me know how it went!


closed #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.