From c1a13f2f40930f6079b92d554dfa967ae492def5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20R=C3=B6tsch?= Date: Mon, 22 Feb 2021 17:20:18 +0100 Subject: [PATCH] fix(contentful): retry on network errors when checking credentials (#29664) (cherry picked from commit b95a199817ec100d7723868c0d25faf868c327f0) --- packages/gatsby-source-contentful/package.json | 1 + packages/gatsby-source-contentful/src/gatsby-node.js | 2 +- yarn.lock | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-contentful/package.json b/packages/gatsby-source-contentful/package.json index 3059c1648491b..3abb6a84d80d4 100644 --- a/packages/gatsby-source-contentful/package.json +++ b/packages/gatsby-source-contentful/package.json @@ -11,6 +11,7 @@ "@contentful/rich-text-react-renderer": "^14.1.2", "@contentful/rich-text-types": "^14.1.2", "@hapi/joi": "^15.1.1", + "@vercel/fetch-retry": "^5.0.3", "axios": "^0.21.1", "chalk": "^4.1.0", "contentful": "^7.15.2", diff --git a/packages/gatsby-source-contentful/src/gatsby-node.js b/packages/gatsby-source-contentful/src/gatsby-node.js index 8cc3398925079..ae0ce31b87a8d 100644 --- a/packages/gatsby-source-contentful/src/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/gatsby-node.js @@ -4,7 +4,7 @@ const _ = require(`lodash`) const fs = require(`fs-extra`) const { createClient } = require(`contentful`) const v8 = require(`v8`) -const fetch = require(`node-fetch`) +const fetch = require(`@vercel/fetch-retry`)(require(`node-fetch`)) const { CODES } = require(`./report`) const normalize = require(`./normalize`) diff --git a/yarn.lock b/yarn.lock index 795cdde94017e..54544397ccdc4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4878,6 +4878,14 @@ "@graphql-typed-document-node/core" "^3.1.0" wonka "^4.0.14" +"@vercel/fetch-retry@^5.0.3": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@vercel/fetch-retry/-/fetch-retry-5.0.3.tgz#cce5d23f6e64f6f525c24e2ac7c78f65d6c5b1f4" + integrity sha512-DIIoBY92r+sQ6iHSf5WjKiYvkdsDIMPWKYATlE0KcUAj2RV6SZK9UWpUzBRKsofXqedOqpVjrI0IE6AWL7JRtg== + dependencies: + async-retry "^1.3.1" + debug "^3.1.0" + "@verdaccio/commons-api@9.7.1", "@verdaccio/commons-api@^9.7.1": version "9.7.1" resolved "https://registry.yarnpkg.com/@verdaccio/commons-api/-/commons-api-9.7.1.tgz#816f08eb6cb0dbe345f2546428c837be6804796d"