gatsby-uc / gatsby-source-strapi

Gatsby source plugin for building websites using Strapi as a data source
MIT License
354 stars 182 forks source link

RequestError: read ECONNRESET (strapi & azure blob) #317

Closed kapy9612 closed 2 years ago

kapy9612 commented 2 years ago

Hi, I'm using gatsby-source-strapi 1.0.3 with latest v3 strapi and azure blob provider plugin.

I used to get this error sometimes, but since today every build fails with this error.

"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle: failed to process https://.../.../uploads/...png (completely different asset for each build) RequestError: read ECONNRESET

On another project with google bucket as provider and a similar number of assets, I have not encountered this error. Does anyone know what the problem might be?

turq84 commented 2 years ago

@kapy9612 Did you get this solved? I've run into the same issue.

kapy9612 commented 2 years ago

@turq84 Yes, I solved it. You have to disable Gatsby image processing, but If you do it, you'll loose the ability to get static images with localFile { publicURL } in graphql queries. I used patch-package for the solution.

The gatsby-source-strapi+1.0.3.patch file looks like this:


diff --git a/node_modules/gatsby-source-strapi/lib/index.js b/node_modules/gatsby-source-strapi/lib/index.js
index 30f2f2f..44340fd 100644
--- a/node_modules/gatsby-source-strapi/lib/index.js
+++ b/node_modules/gatsby-source-strapi/lib/index.js
@@ -43,7 +43,7 @@ const singleTypeToTypeInfo = singleType => toTypeInfo(singleType, {

 const fetchEntities = async (entityDefinition, ctx) => {
   const entities = await (0, _fetch.default)(entityDefinition, ctx);
-  await _normalize.default.downloadMediaFiles(entities, ctx);
+  //await _normalize.default.downloadMediaFiles(entities, ctx); comment it out, to not pull images
   return entities;
 };```
turq84 commented 2 years ago

@kapy9612 Thanks for your reply! 🙏🏻 By using the solution above, you no longer get the images from Strapi? My problem is, I need to fetch the images from Strapi, but I get the ECONNRESET error you mentioned. Hmmm.... maybe this isn't the best approach for me. 🤔

kapy9612 commented 2 years ago

@turq84 If you use Google Bucket it wont be a problem. You use only the image { url } in the queries.