gologin 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Combined changelog for GoLogin node.js SDK
4
4
 
5
+ ## [3.0.4] 2026-09-04
6
+
7
+ ### Fixes
8
+
9
+ * Fixed proxy request timeout not aborting hung TCP connects during timezone checks
10
+ * Reduced default proxy check timeout to 10s and attempts to 2
11
+
5
12
  ## [3.0.3] 2026-08-03
6
13
 
7
14
  ### Fixes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gologin",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "A high-level API to control Orbita browser over GoLogin API",
5
5
  "types": "./index.d.ts",
6
6
  "main": "./src/index.js",
package/src/gologin.js CHANGED
@@ -80,13 +80,14 @@ export class GoLogin {
80
80
  this.timezone = options.timezone;
81
81
  this.extensionPathsToInstall = [];
82
82
  this.customArgs = options.args || [];
83
+ this.profileLaunchArguments = [];
83
84
  this.restoreLastSession = options.restoreLastSession || true;
84
85
  this.processSpawned = null;
85
86
  this.processKillTimeout = 1 * 1000;
86
87
  this.browserMajorVersion = options.browserMajorVersion || 0;
87
88
  this.newProxyOrbitaMajorVersion = 135;
88
- this.proxyCheckTimeout = options.proxyCheckTimeout || 13 * 1000;
89
- this.proxyCheckAttempts = options.proxyCheckAttempts || 3;
89
+ this.proxyCheckTimeout = options.proxyCheckTimeout || 10 * 1000;
90
+ this.proxyCheckAttempts = options.proxyCheckAttempts || 2;
90
91
  this.customChromeFrame = options.customChromeFrame;
91
92
 
92
93
  if (options.tmpdir) {
@@ -489,6 +490,8 @@ export class GoLogin {
489
490
  throw new Error('Error fetching profile data');
490
491
  }
491
492
 
493
+ this.profileLaunchArguments = (profile.launchArguments || '').split(' ').filter(Boolean);
494
+
492
495
  const { navigator = {}, fonts, os: profileOs } = profile;
493
496
  this.fontsMasking = fonts?.enableMasking;
494
497
  this.profileOs = profileOs;
@@ -570,6 +573,7 @@ export class GoLogin {
570
573
  name: 'readPreferences',
571
574
  promise: readFile(join(profilePath, 'Default', 'Preferences')),
572
575
  });
576
+
573
577
  const preferences = JSON.parse(preferences_raw.toString());
574
578
  const chromeExtensions = get(profile, 'chromeExtensions') || [];
575
579
  const userChromeExtensions = get(profile, 'userChromeExtensions') || [];
@@ -1008,6 +1012,10 @@ export class GoLogin {
1008
1012
  params = params.concat(this.extra_params);
1009
1013
  }
1010
1014
 
1015
+ if (this.profileLaunchArguments.length) {
1016
+ params = params.concat(this.profileLaunchArguments);
1017
+ }
1018
+
1011
1019
  if (this.remote_debugging_port) {
1012
1020
  params.push(`--remote-debugging-port=${this.remote_debugging_port}`);
1013
1021
  }
@@ -1042,6 +1050,7 @@ export class GoLogin {
1042
1050
  name: 'getBrowserChecker',
1043
1051
  promise: this.getBrowserChecker(),
1044
1052
  });
1053
+
1045
1054
  ORBITA_BROWSER = browserChecker.getOrbitaPath;
1046
1055
  }
1047
1056
 
@@ -1123,6 +1132,10 @@ export class GoLogin {
1123
1132
  params = params.concat(this.extra_params);
1124
1133
  }
1125
1134
 
1135
+ if (this.profileLaunchArguments.length) {
1136
+ params = params.concat(this.profileLaunchArguments);
1137
+ }
1138
+
1126
1139
  if (!this.isFirstSession && this.restoreLastSession) {
1127
1140
  params.push('--restore-last-session');
1128
1141
  }
package/src/utils/http.js CHANGED
@@ -1,5 +1,5 @@
1
- import { get as _get, request as httpsRequest } from 'https';
2
1
  import { request as httpRequest } from 'http';
2
+ import { get as _get, request as httpsRequest } from 'https';
3
3
 
4
4
  import packageJson from '../../package.json' with { type: 'json' };
5
5
  import { loadHttpsProxyAgent } from './lazy-deps.js';
@@ -115,9 +115,11 @@ const normalizeProxyUrl = (proxyUrl) => {
115
115
  };
116
116
 
117
117
  const executeProxyRequest = async (url, options, internalOptions) => {
118
- const HttpsProxyAgent = await loadHttpsProxyAgent();
119
- const agent = new HttpsProxyAgent(normalizeProxyUrl(options.proxy));
120
118
  const timeoutMs = options.timeout || DEFAULT_TIMEOUT_MS;
119
+ const HttpsProxyAgent = await loadHttpsProxyAgent();
120
+ const agent = new HttpsProxyAgent(normalizeProxyUrl(options.proxy), {
121
+ timeout: timeoutMs,
122
+ });
121
123
  const headers = buildRequestHeaders({ options, internalOptions });
122
124
  const body = buildRequestBody(options);
123
125
  const method = options.method || 'GET';
@@ -139,6 +141,19 @@ const executeProxyRequest = async (url, options, internalOptions) => {
139
141
  };
140
142
 
141
143
  return new Promise((resolve, reject) => {
144
+ let settled = false;
145
+ let timeoutId;
146
+
147
+ const settle = (handler) => (value) => {
148
+ if (settled) {
149
+ return;
150
+ }
151
+
152
+ settled = true;
153
+ clearTimeout(timeoutId);
154
+ handler(value);
155
+ };
156
+
142
157
  const req = requestFn(requestOptions, (response) => {
143
158
  let responseText = '';
144
159
 
@@ -151,18 +166,28 @@ const executeProxyRequest = async (url, options, internalOptions) => {
151
166
  const error = new Error(responseText);
152
167
  error.statusCode = response.statusCode;
153
168
 
154
- reject(error);
169
+ settle(reject)(error);
155
170
 
156
171
  return;
157
172
  }
158
173
 
159
- resolve(parseProxyResponseBody(responseText, options));
174
+ settle(resolve)(parseProxyResponseBody(responseText, options));
160
175
  });
176
+
177
+ response.on('error', settle(reject));
161
178
  });
162
179
 
163
- req.on('error', reject);
180
+ timeoutId = setTimeout(() => {
181
+ const timeoutError = new Error(`Request timeout after ${timeoutMs}ms`);
182
+ settle(reject)(timeoutError);
183
+ req.destroy(timeoutError);
184
+ }, timeoutMs);
185
+
186
+ req.on('error', settle(reject));
164
187
  req.on('timeout', () => {
165
- req.destroy(new Error(`Request timeout after ${timeoutMs}ms`));
188
+ const timeoutError = new Error(`Request timeout after ${timeoutMs}ms`);
189
+ settle(reject)(timeoutError);
190
+ req.destroy(timeoutError);
166
191
  });
167
192
 
168
193
  if (body) {
@@ -242,6 +267,7 @@ export const makeRequest = async (url, options = {}, internalOptions) => {
242
267
  try {
243
268
  return await executeFetch(url, options, internalOptions);
244
269
  } catch (error) {
270
+ console.log('makeRequest error', error);
245
271
  if (internalOptions?.fallbackUrl && !error.statusCode) {
246
272
  return executeFetch(internalOptions.fallbackUrl, options, internalOptions);
247
273
  }