try to debug the _a.destroy problem

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-06-19 14:44:35 +02:00
parent 29a0f56831
commit 96be5d14d8
6 changed files with 142 additions and 4 deletions
+26 -1
View File
@@ -150,7 +150,32 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
node-version:
[
18.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
]
name: Test ${{ matrix.node-version }}
services:
@@ -0,0 +1,18 @@
diff --git a/lib/interceptors/ClientRequest/NodeClientRequest.js b/lib/interceptors/ClientRequest/NodeClientRequest.js
index 9bcc5a6adfd3c84541d686c3d0039f5e79dd34f5..f72d47b02a437eaefead4ec1543a0dd70dd1bb6f 100644
--- a/lib/interceptors/ClientRequest/NodeClientRequest.js
+++ b/lib/interceptors/ClientRequest/NodeClientRequest.js
@@ -382,6 +382,13 @@ var NodeClientRequest = /** @class */ (function (_super) {
*/
NodeClientRequest.prototype.terminate = function () {
var _a;
+ const tempAgent = this.agent;
+ if (tempAgent && typeof tempAgent === 'object' && typeof tempAgent.destroy !== 'function') {
+ console.log(
+ `No agent to destroy, found '${typeof tempAgent}'->'${typeof tempAgent.destroy}':`,
+ tempAgent
+ );
+ }
// @ts-ignore
(_a = this.agent) === null || _a === void 0 ? void 0 : _a.destroy();
};
@@ -0,0 +1,36 @@
diff --git a/lib/node/chunk-CVV3L375.mjs b/lib/node/chunk-CVV3L375.mjs
index c37d61d709235efebe4ea19703a901bfbc05c9e3..4085c9b33075e18f7e4e3ad82fdd3fa5f6bb31e2 100644
--- a/lib/node/chunk-CVV3L375.mjs
+++ b/lib/node/chunk-CVV3L375.mjs
@@ -540,6 +540,13 @@ var _NodeClientRequest = class extends ClientRequest {
* Terminates a pending request.
*/
terminate() {
+ const tempAgent = this.agent;
+ if (tempAgent && typeof tempAgent === 'object' && typeof tempAgent.destroy !== 'function') {
+ console.log(
+ `No agent to destroy, found '${typeof tempAgent}'->'${typeof tempAgent.destroy}':`,
+ tempAgent
+ );
+ }
var _a;
(_a = this.agent) == null ? void 0 : _a.destroy();
}
diff --git a/lib/node/chunk-SXGRMPXP.js b/lib/node/chunk-SXGRMPXP.js
index a5129f18a9b754acf2bfb3b1545df2378b01a95a..8228b6d4f649937559f45aefbdb8c8df275c5285 100644
--- a/lib/node/chunk-SXGRMPXP.js
+++ b/lib/node/chunk-SXGRMPXP.js
@@ -540,6 +540,13 @@ var _NodeClientRequest = class extends _http.ClientRequest {
* Terminates a pending request.
*/
terminate() {
+ const tempAgent = this.agent;
+ if (tempAgent && typeof tempAgent === 'object' && typeof tempAgent.destroy !== 'function') {
+ console.log(
+ `No agent to destroy, found '${typeof tempAgent}'->'${typeof tempAgent.destroy}':`,
+ tempAgent
+ );
+ }
var _a;
(_a = this.agent) == null ? void 0 : _a.destroy();
}
+3
View File
@@ -87,6 +87,8 @@
"@changesets/assemble-release-plan@^6.0.0": "patch:@changesets/assemble-release-plan@npm%3A6.0.0#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.0-f7b3005037.patch",
"@material-ui/pickers@^3.2.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
"@material-ui/pickers@^3.3.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
"@mswjs/interceptors@^0.17.10": "patch:@mswjs/interceptors@npm%3A0.17.10#.yarn/patches/@mswjs-interceptors-npm-0.17.10-c1199a9424.patch",
"@mswjs/interceptors@^0.29.0": "patch:@mswjs/interceptors@npm%3A0.29.1#./.yarn/patches/@mswjs-interceptors-npm-0.29.1-b5be72ad54.patch",
"@types/react": "^18",
"@types/react-dom": "^18",
"jest-haste-map@^29.7.0": "patch:jest-haste-map@npm%3A29.7.0#./.yarn/patches/jest-haste-map-npm-29.7.0-e3be419eff.patch"
@@ -94,6 +96,7 @@
"dependencies": {
"@backstage/errors": "workspace:^",
"@manypkg/get-packages": "^1.1.3",
"@types/global-agent": "^2.1.3",
"@useoptic/optic": "^0.50.10"
},
"devDependencies": {
+19 -1
View File
@@ -14,6 +14,12 @@
* limitations under the License.
*/
import { bootstrap } from 'global-agent';
if (shouldUseGlobalAgent()) {
bootstrap();
}
import fs from 'fs-extra';
import chalk from 'chalk';
import ora from 'ora';
@@ -38,10 +44,22 @@ import {
getManifestByVersion,
ReleaseManifest,
} from '@backstage/release-manifests';
import 'global-agent/bootstrap';
import { PackageGraph } from '@backstage/cli-node';
import { migrateMovedPackages } from './migrate';
function shouldUseGlobalAgent(): boolean {
// see https://www.npmjs.com/package/global-agent
const namespace =
process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? 'GLOBAL_AGENT_';
if (
process.env[`${namespace}HTTP_PROXY`] ||
process.env[`${namespace}HTTPS_PROXY`]
) {
return true;
}
return false;
}
const DEP_TYPES = [
'dependencies',
'devDependencies',
+40 -2
View File
@@ -10782,7 +10782,7 @@ __metadata:
languageName: node
linkType: hard
"@mswjs/interceptors@npm:^0.17.10":
"@mswjs/interceptors@npm:0.17.10":
version: 0.17.10
resolution: "@mswjs/interceptors@npm:0.17.10"
dependencies:
@@ -10798,7 +10798,7 @@ __metadata:
languageName: node
linkType: hard
"@mswjs/interceptors@npm:^0.29.0":
"@mswjs/interceptors@npm:0.29.1":
version: 0.29.1
resolution: "@mswjs/interceptors@npm:0.29.1"
dependencies:
@@ -10812,6 +10812,36 @@ __metadata:
languageName: node
linkType: hard
"@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.17.10#.yarn/patches/@mswjs-interceptors-npm-0.17.10-c1199a9424.patch::locator=root%40workspace%3A.":
version: 0.17.10
resolution: "@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.17.10#.yarn/patches/@mswjs-interceptors-npm-0.17.10-c1199a9424.patch::version=0.17.10&hash=652df3&locator=root%40workspace%3A."
dependencies:
"@open-draft/until": ^1.0.3
"@types/debug": ^4.1.7
"@xmldom/xmldom": ^0.8.3
debug: ^4.3.3
headers-polyfill: 3.2.5
outvariant: ^1.2.1
strict-event-emitter: ^0.2.4
web-encoding: ^1.1.5
checksum: 32ca2f2d4e8bc46e1f773ca440a0ec5ba9c69ea4d89c07fbd25a0fde73627a232eb7d0cf3ce426fbe1fd58863ab9c84386352ecdc55eeb2a5240ba126c0ba6f0
languageName: node
linkType: hard
"@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.29.1#./.yarn/patches/@mswjs-interceptors-npm-0.29.1-b5be72ad54.patch::locator=root%40workspace%3A.":
version: 0.29.1
resolution: "@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.29.1#./.yarn/patches/@mswjs-interceptors-npm-0.29.1-b5be72ad54.patch::version=0.29.1&hash=d6ea98&locator=root%40workspace%3A."
dependencies:
"@open-draft/deferred-promise": ^2.2.0
"@open-draft/logger": ^0.3.0
"@open-draft/until": ^2.0.0
is-node-process: ^1.2.0
outvariant: ^1.2.1
strict-event-emitter: ^0.5.1
checksum: d7ce191736c8b5df2dcdb36d11dbf25ca37cd3c0d1319cf8594713c443c5bdf733c2aeb4863aba646a67b50813e64dc1b13fbd31cee238cc4c9f8a8fd2908486
languageName: node
linkType: hard
"@mui/base@npm:5.0.0-beta.40":
version: 5.0.0-beta.40
resolution: "@mui/base@npm:5.0.0-beta.40"
@@ -17173,6 +17203,13 @@ __metadata:
languageName: node
linkType: hard
"@types/global-agent@npm:^2.1.3":
version: 2.1.3
resolution: "@types/global-agent@npm:2.1.3"
checksum: 6129b6d5ba871b9d111ddf91e6f9a1725d3f28bf2aa6869ec83bebd14c688cde4275ebea6fa45b0b1c00d78109d022c935f952e9e4876d76289d4706484776c3
languageName: node
linkType: hard
"@types/google-protobuf@npm:^3.7.2":
version: 3.15.12
resolution: "@types/google-protobuf@npm:3.15.12"
@@ -39395,6 +39432,7 @@ __metadata:
"@spotify/eslint-plugin": ^15.0.0
"@spotify/prettier-config": ^15.0.0
"@techdocs/cli": "workspace:*"
"@types/global-agent": ^2.1.3
"@types/node": ^18.17.8
"@types/webpack": ^5.28.0
"@useoptic/optic": ^0.50.10