The site in question is at https://bimlogs.netlify.app/.
I’m creating an interface with Gatsby to read/write to a Google Sheet. I am using the google-auth-library and google-spreadsheet packages, and there’s a known issue about one of the dependency packages (gaxios).
The issue prevents a successful API connection but can be resolved by updating a couple of lines in a single file in node_modules/gaxios. I’ve used patch-package to make the update, here’s the output of that patch file:
diff --git a/node_modules/gaxios/build/src/gaxios.js b/node_modules/gaxios/build/src/gaxios.js
index b9fc1c0..5de90a3 100644
--- a/node_modules/gaxios/build/src/gaxios.js
+++ b/node_modules/gaxios/build/src/gaxios.js
@@ -273,7 +273,7 @@ class Gaxios {
exports.Gaxios = Gaxios;
_a = Gaxios, _Gaxios_instances = new WeakSet(), _Gaxios_urlMayUseProxy = function _Gaxios_urlMayUseProxy(url, noProxy = []) {
var _b, _c;
- const candidate = new url_1.URL(url);
+ const candidate = new url_1.Url(url);
const noProxyList = [...noProxy];
const noProxyEnvList = ((_c = ((_b = process.env.NO_PROXY) !== null && _b !== void 0 ? _b : process.env.no_proxy)) === null || _c === void 0 ? void 0 : _c.split(',')) || [];
for (const rule of noProxyEnvList) {
@@ -287,7 +287,7 @@ _a = Gaxios, _Gaxios_instances = new WeakSet(), _Gaxios_urlMayUseProxy = functio
}
}
// Match URL
- else if (rule instanceof url_1.URL) {
+ else if (rule instanceof url_1.Url) {
if (rule.origin === candidate.origin) {
return false;
}
This works perfectly on my local environment, but when deploying to Netlify, the patch doesn’t work. I don’t get any build errors and the deployment is completed with no problems, but when checking the console of the deployed site the error from the unpatched dependency folder is still appearing and the API is unable to connect. The patch folder and file are committed to my repo correctly, and the patch-package instruction is appearing as completed in my build log, but they don’t seem to be updating the error in the dependency file as expected.
I’m new to Gatsby, Netlify and have never used patch-package before, but pulling my hair out as to what’s missing. Any help or insight is greatly appreciated!
Screenshot of build log:
Package.json contents:
{
"name": "bim-dive-tracker",
"version": "1.0.0",
"private": true,
"description": "bim-dive-tracker",
"keywords": [
"gatsby"
],
"scripts": {
"develop": "gatsby develop",
"start": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
"clean": "gatsby clean",
"postinstall": "patch-package"
},
"dependencies": {
"assert": "^2.1.0",
"crypto-browserify": "^3.12.1",
"gatsby": "^5.13.7",
"gatsby-plugin-sass": "^6.13.1",
"gaxios": "^6.7.1",
"google-auth-library": "^9.14.2",
"google-spreadsheet": "^4.1.4",
"https-browserify": "^1.0.0",
"patch-package": "^8.0.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"querystring-es3": "^0.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.80.4",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"url": "^0.11.4",
"util": "^0.12.5"
}
}