Gatsby Preview Plugin beta is live

Good news for all Gatsby and Strapi users!

We have just released a beta version of the Gatsby Preview plugin.
The plugin inserts a preview button in the Content Manager to preview content in Gatsby Cloud.

The gatsby-source-strapi plugin is now supporting Strapi v4, Gatsby 4, gatsby-plugin-image , incremental builds, CMS Preview, Content Sync! It’s in beta, so all feedback is welcome.

We have also updated the Strapi Starter Gatsby Blog with the new version.

Please let us know what you think about it in this thread :slight_smile:

1 Like

That’s great. Looking forward to trying it out.

Is the gatsby-source-strapi plugin now compatible with Gatsby v4? If not is there a timeline on that?

Cheers

Yes, it is compatible with Gatsby v4! It’s in beta so feedback is welcome :slight_smile:

Been really struggling with the beta plugin. Also your Strapi Starter Gatsby Blog example is not working either?

Just keeps throwing graphql errors like ‘Cannot query field “allStrapiArticle” on type “Query”’

Have you got any advice?

1 Like

I did generate an APIToken and applied that to the gatsby-config

I am struggling to make it work but it does not work. Sometime throws error 404 even if the collection type exists and is public. After changing the API_URL to ‘http://localhost:1337/api’ started working but after customizing queryParams throws another error.

"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
Cannot read property 'toLowerCase' of undefined
TypeError: Cannot read property 'toLowerCase' of undefined

I have been waiting for months for this Gatsby plugin and still I am not able to use it :expressionless:

1 Like

Hello and thanks for trying the beta, your feedback at this stage is very useful.

I think it’s possible that you may be running into problems because of a wrong configuration.

First, you should not have /api in your API_URL. Instead, use a value like http://localhost:1337, and make sure there’s no trailing slash. (ping @bledar)

Second, the source plugin now requires an API token to work. And this token must have full access. Can you make sure that’s what you did @Deviant_Dev?

Also I think I know what you mean when you say the starter is broken. It’s because the create-strapi-starter CLI cannot currently create that API token for you. So you have to generate it, add it to your gatsby config, and restart the frontend server. I’d actually encourage you to check the starter’s configuration if you need a code reference.

Also, remember to restart the Gatsby server every time you make changes to the gatsby-config.js file, and try running gatsby clean when you get unexpected errors.

Of course we’ll be happy to make code fixes if you still run into issues after making these changes.

@remidej I did do 99% of what you suggested. Turns out I was using the wrong environment file so the token was being passed through correctly to gatsby. Thank you for your help.

I can hopefully use this starter to help me with my migration. I will post on this thread my findings on our real world migration.

1 Like