SilverStripe 4.5.0 Gatsby endpoint is returning error and null data

Silverstripe Version: 4.5.0

Question:

I am struggling to run the Gatsby Module on my Silverstripe project.

Here is my composer file:

{
"name": "silverstripe/installer",
"type": "silverstripe-recipe",
"description": "The SilverStripe Framework Installer",
"require": {
    "php": ">=7.3",
    "silverstripe/recipe-plugin": "^1.3",
    "silverstripe/recipe-cms": "4.5.0@stable",
    "silverstripe-themes/simple": "^3.2.0",
    "silverstripe/spamprotection": "^3.0.1",
    "silverstripe/silverstripe-gatsby": "dev-master"
},
"require-dev": {
    "phpunit/phpunit": "^5.7"
},
"extra": {
    "resources-dir": "_resources",
    "project-files-installed": [
        "app/.htaccess",
        "app/_config.php",
        "app/_config/mysite.yml",
        "app/src/Page.php",
        "app/src/PageController.php"
    ],
    "public-files-installed": [
        ".htaccess",
        "index.php",
        "web.config"
    ]
},
"config": {
    "process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"

}

I added it to my composer according to the plugin page.

composer require silverstripe/silverstripe-gatsby

When I try to check the endpoint which is:

http://example.com/__gatsby/graphql

I am getting this:

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

I tried to check the logs but no clue of whats going on. No errors were found in there.

Is there a way to enable the debug or something that gives me some hints on how to solve this?

My SilverStripe is working perfectly and not errors are being added to the logs.

When I try to check the endpoint which is: http://example.com/__gatsby/graphql

Are you just trying to load the URL? That’s a graphql endpoint so I assume you would need to provide a query in order to get anything back. I think you need to send it a request of this format GitHub - silverstripe/silverstripe-gatsby: Provides a GraphQL API that allows Gatsby to use your SilverStripe CMS as a data source

You could use Postman to send it: GraphQL in Postman | Postman Learning Center

That module doesn’t have any tagged releases yet though, so might not be ready for production use?

Oh lol, Hi Alyson! :wave:

1 Like

Hey Jono. :slight_smile:
Thanks for your answer. I noticed that I need to run a query in order to get any results.

Perfect Jono. Thanks for the heads up! :smiley: