Question

Gatsby failing with Strapi on DigitalOcean

Posted June 4, 2021 439 views
NetworkingDigitalOcean Droplets

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.

1 comment

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.

×
Submit an Answer
1 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'),
    },
  },
});