Question

Gatsby failing with Strapi on DigitalOcean

Hey,

I’ve created a DO droplet and installed Strapi and the setup seems fine. However, when I try to deploy on GatsbyJS for the Gatsby side, I get an error:

error Failed to fetch data from Strapi connect ETIMEDOUT 0.0.5.57:80

And I don’t understand this error or the IP address and why it has changed from the address I have setup Strapi on.

This is the full error log with my ip changed:

17:57:53 PM:

info Starting to fetch data from Strapi - 1.1.1.1:1337/articles with params {"_limit":1000}
17:57:53 PM:

info Starting to fetch data from Strapi -  1.1.1.1:1337/categories with params {"_limit":1000}
17:57:53 PM:

info Starting to fetch data from Strapi -  1.1.1.1:1337/writers with params {"_limit":1000}
17:57:53 PM:

info Starting to fetch data from Strapi -  1.1.1.1:1337/homepage with params {"_limit":1000}
17:57:53 PM:

info Starting to fetch data from Strapi -  1.1.1.1:1337/global with params {"_limit":1000}
18:00:02 PM:

error Failed to fetch data from Strapi connect ETIMEDOUT 0.0.5.57:80
18:00:03 PM:

  Error: connect ETIMEDOUT 0.0.5.57:80
18:00:03 PM:

not finished source and transform nodes - 129.231s
18:00:03 PM:

not finished Fetched Strapi Data - 129.080s
18:00:05 PM:

ERROR Failed to compile: Error: Exited with code 1

At first I thought it may be timing out with lack of resources, so I upped them quite a lot and tried again but still received the same error.

I’m not sure what to check next. I contacted Gatsby where the frontend is hosted and they said it is most likely my DO configuration but I’m not really sure.

Any help would be really appreciated, this is the last part for me to get my first website that is front and backend all working.

I am really new to this side of dev as I’m a junior frontend developer.

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Thanks for the reply, I’ve managed to find out what the problem was… my environment variable was missing the http:// from the front of it, have done a rebuild and it now works.

However, just in case there is anything else missing, this is my server.js

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', 'my-super-secret-key'),
    },
  },
});

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel