From a2854173eb177aec754681f51bff473cbd6f1ecc Mon Sep 17 00:00:00 2001 From: Gonzalo Avalos Ribas Date: Tue, 30 Sep 2025 15:28:38 -0300 Subject: [PATCH 1/2] Remove Troubleshoot command --- package-lock.json | 298 +----------------- packages/integration-sdk-cli/package.json | 3 +- .../src/commands/troubleshoot.ts | 16 - .../src/troubleshoot/index.ts | 1 - .../src/troubleshoot/troubleshoot.ts | 34 -- .../src/troubleshoot/utils.ts | 111 ------- .../src/logger/index.ts | 8 + 7 files changed, 11 insertions(+), 460 deletions(-) delete mode 100644 packages/integration-sdk-cli/src/commands/troubleshoot.ts delete mode 100644 packages/integration-sdk-cli/src/troubleshoot/index.ts delete mode 100644 packages/integration-sdk-cli/src/troubleshoot/troubleshoot.ts delete mode 100644 packages/integration-sdk-cli/src/troubleshoot/utils.ts diff --git a/package-lock.json b/package-lock.json index fa45683df..333a14441 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6969,20 +6969,6 @@ "node": ">=0.10.0" } }, - "node_modules/asn1": { - "version": "0.2.6", - "license": "MIT", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, "node_modules/astral-regex": { "version": "2.0.0", "license": "MIT", @@ -7016,17 +7002,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.12.0", - "license": "MIT" - }, "node_modules/axios": { "version": "0.27.2", "license": "MIT", @@ -7260,13 +7235,6 @@ "version": "5.1.2", "license": "MIT" }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "license": "BSD-3-Clause", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, "node_modules/before-after-hook": { "version": "2.2.3", "dev": true, @@ -7685,10 +7653,6 @@ "version": "2.6.2", "license": "0BSD" }, - "node_modules/caseless": { - "version": "0.12.0", - "license": "Apache-2.0" - }, "node_modules/chalk": { "version": "2.4.2", "license": "MIT", @@ -8177,6 +8141,7 @@ }, "node_modules/core-util-is": { "version": "1.0.2", + "dev": true, "license": "MIT" }, "node_modules/cors": { @@ -8321,16 +8286,6 @@ "node": ">=8" } }, - "node_modules/dashdash": { - "version": "1.14.1", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/data-view-buffer": { "version": "1.0.1", "dev": true, @@ -8728,18 +8683,6 @@ "dev": true, "license": "MIT" }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "license": "MIT", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/ecc-jsbn/node_modules/jsbn": { - "version": "0.1.1", - "license": "MIT" - }, "node_modules/ee-first": { "version": "1.1.1", "license": "MIT" @@ -9706,13 +9649,6 @@ "node": ">=4" } }, - "node_modules/extsprintf": { - "version": "1.3.0", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT" - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "license": "MIT" @@ -10014,13 +9950,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/forever-agent": { - "version": "0.6.1", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, "node_modules/form-data": { "version": "4.0.0", "license": "MIT", @@ -10329,13 +10258,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/getpass": { - "version": "0.1.7", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, "node_modules/git-raw-commits": { "version": "3.0.0", "dev": true, @@ -10590,42 +10512,6 @@ "uglify-js": "^3.1.4" } }, - "node_modules/har-schema": { - "version": "2.0.0", - "license": "ISC", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "license": "MIT", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/har-validator/node_modules/ajv": { - "version": "6.12.6", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/har-validator/node_modules/json-schema-traverse": { - "version": "0.4.1", - "license": "MIT" - }, "node_modules/hard-rejection": { "version": "2.1.0", "dev": true, @@ -10807,19 +10693,6 @@ "node": ">= 6" } }, - "node_modules/http-signature": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, "node_modules/https-proxy-agent": { "version": "5.0.1", "dev": true, @@ -11796,10 +11669,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "license": "MIT" - }, "node_modules/is-unc-path": { "version": "1.0.0", "license": "MIT", @@ -11906,10 +11775,6 @@ "node": ">=0.10.0" } }, - "node_modules/isstream": { - "version": "0.1.2", - "license": "MIT" - }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "license": "BSD-3-Clause", @@ -13540,10 +13405,6 @@ "version": "2.3.1", "license": "MIT" }, - "node_modules/json-schema": { - "version": "0.4.0", - "license": "(AFL-2.1 OR BSD-3-Clause)" - }, "node_modules/json-schema-traverse": { "version": "1.0.0", "license": "MIT" @@ -13611,19 +13472,6 @@ "node": "*" } }, - "node_modules/jsprim": { - "version": "1.4.2", - "license": "MIT", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/keycharm": { "version": "0.2.0", "dev": true @@ -16616,13 +16464,6 @@ "node": ">=12" } }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, "node_modules/object-assign": { "version": "4.1.1", "license": "MIT", @@ -17444,10 +17285,6 @@ "node": ">=8" } }, - "node_modules/performance-now": { - "version": "2.1.0", - "license": "MIT" - }, "node_modules/picocolors": { "version": "1.0.1", "license": "ISC" @@ -17801,10 +17638,6 @@ "dev": true, "license": "MIT" }, - "node_modules/psl": { - "version": "1.9.0", - "license": "MIT" - }, "node_modules/pump": { "version": "3.0.0", "license": "MIT", @@ -18357,61 +18190,6 @@ "node": ">=0.10" } }, - "node_modules/request": { - "version": "2.88.2", - "license": "Apache-2.0", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request/node_modules/form-data": { - "version": "2.3.3", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/request/node_modules/qs": { - "version": "6.5.3", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/request/node_modules/uuid": { - "version": "3.4.0", - "license": "MIT", - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/require-directory": { "version": "2.1.1", "license": "MIT", @@ -19225,33 +19003,6 @@ "dev": true, "license": "BSD-3-Clause" }, - "node_modules/sshpk": { - "version": "1.18.0", - "license": "MIT", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sshpk/node_modules/jsbn": { - "version": "0.1.1", - "license": "MIT" - }, "node_modules/ssri": { "version": "9.0.1", "dev": true, @@ -19740,17 +19491,6 @@ "node": ">=0.6" } }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, "node_modules/tr46": { "version": "0.0.3", "license": "MIT" @@ -20146,20 +19886,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "license": "Unlicense" - }, "node_modules/type-check": { "version": "0.4.0", "license": "MIT", @@ -20481,13 +20207,6 @@ "punycode": "^2.1.0" } }, - "node_modules/url-exists": { - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "request": "^2.69.0" - } - }, "node_modules/url-parse": { "version": "1.5.10", "license": "MIT", @@ -20587,18 +20306,6 @@ "node": ">= 0.8" } }, - "node_modules/verror": { - "version": "1.10.0", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "node_modules/vis": { "version": "4.21.0-EOL", "dev": true, @@ -21061,8 +20768,7 @@ "neo4j-driver": "^4.3.3", "plop": "^3.1.2", "runtypes": "5.1.0", - "upath": "^1.2.0", - "url-exists": "^1.0.3" + "upath": "^1.2.0" }, "bin": { "j1-integration": "bin/j1-integration" diff --git a/packages/integration-sdk-cli/package.json b/packages/integration-sdk-cli/package.json index 96d77f23e..bc7681740 100644 --- a/packages/integration-sdk-cli/package.json +++ b/packages/integration-sdk-cli/package.json @@ -40,8 +40,7 @@ "neo4j-driver": "^4.3.3", "plop": "^3.1.2", "runtypes": "5.1.0", - "upath": "^1.2.0", - "url-exists": "^1.0.3" + "upath": "^1.2.0" }, "devDependencies": { "@jupiterone/data-model": "^0.62.0", diff --git a/packages/integration-sdk-cli/src/commands/troubleshoot.ts b/packages/integration-sdk-cli/src/commands/troubleshoot.ts deleted file mode 100644 index ffa725358..000000000 --- a/packages/integration-sdk-cli/src/commands/troubleshoot.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { createCommand } from 'commander'; - -import { troubleshoot } from '../troubleshoot'; - -export function troubleshootLocalExecution() { - return createCommand('troubleshoot') - .description('troubleshoot common issues with local execution') - .option( - '-p, --project-path ', - 'path to integration project directory', - process.cwd(), - ) - .action(async (options) => { - await troubleshoot(options); - }); -} diff --git a/packages/integration-sdk-cli/src/troubleshoot/index.ts b/packages/integration-sdk-cli/src/troubleshoot/index.ts deleted file mode 100644 index be8062c5b..000000000 --- a/packages/integration-sdk-cli/src/troubleshoot/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './troubleshoot'; diff --git a/packages/integration-sdk-cli/src/troubleshoot/troubleshoot.ts b/packages/integration-sdk-cli/src/troubleshoot/troubleshoot.ts deleted file mode 100644 index baf016680..000000000 --- a/packages/integration-sdk-cli/src/troubleshoot/troubleshoot.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as log from '../log'; -import * as os from 'os'; -import { - executeValidateAuthentication, - executeWithLogging, - getVersions, -} from './utils'; - -// Check items that our integrations aren't already checking or items -// that would normally be checked or handled by the managed execution -// in JupiterOne -export async function troubleshoot(options) { - log.info(`Troubleshooting code found at ${options.projectPath}`); - - log.info(`Checking Operating System Information`); - log.info(`OS Architecture: ${os.arch()}`); - log.info(`OS Platform: ${os.platform()}`); - log.info(`OS Version: ${os.version()}`); - - log.info(`Checking Node version: ${process.version}`); - // Check versions of packages (SDK, graph project, ) and suggest that they upgrade if it is out of date - getVersions(options.projectPath); - - log.info(`Checking for Docker Info`); - await executeWithLogging('docker info'); - - // Check authentication. If this fails, we will also check if it - // might be due to missing or self signed certs - await executeValidateAuthentication(options.projectPath); -} - -// TODO (adam-in-ict) In the future, possibly run this every time it is run outside the managed environment? - -// TODO (adam-in-ict) Should we add a preamble to every execution that shows SDK version and graph- project? diff --git a/packages/integration-sdk-cli/src/troubleshoot/utils.ts b/packages/integration-sdk-cli/src/troubleshoot/utils.ts deleted file mode 100644 index 362911fde..000000000 --- a/packages/integration-sdk-cli/src/troubleshoot/utils.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { - createIntegrationInstanceForLocalExecution, - prepareLocalStepCollection, -} from '@jupiterone/integration-sdk-runtime'; -import { exec } from 'child_process'; -import * as log from '../log'; -import path from 'path'; -import { loadConfig } from '../config'; -import urlExists from 'url-exists'; -import * as fs from 'fs'; - -export async function executeWithLogging(command: string) { - return new Promise((resolve, reject) => { - const childProcess = exec(command); - - if (childProcess.stdout) { - childProcess.stdout.pipe(process.stdout); - } - - childProcess.on('exit', () => { - resolve(); - }); - - childProcess.on('error', (err) => { - reject(err); - }); - }); -} - -export async function executeValidateAuthentication(directory: string) { - log.info(`Checking authentication using values in .env file`); - try { - const config = prepareLocalStepCollection( - await loadConfig(path.join(directory, 'src')), - ); - - await import(`${directory}/src/index`).then( - async ({ invocationConfig }) => { - await invocationConfig.validateInvocation({ - instance: createIntegrationInstanceForLocalExecution(config), - }); - }, - ); - } catch (err) { - log.info(`Call to validateInvocation failed.`); - log.info(JSON.stringify(err)); - if (err.endpoint) { - endpointCheck(err.endpoint); - } - } -} - -export function endpointCheck(url: string) { - log.info(`Checking availability of endpoint ${url}`); - try { - urlExists(url, function (err, exists) { - if (exists) { - log.info(`Endpoint can be successfully reached.`); - } else { - log.info( - `Checking availability of endpoint with certificate verification disabled.`, - ); - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - urlExists(url, function (err, exists) { - if (exists) { - log.info( - `Endpoint can be successfully reached only after disabling TLS certificate validation.`, - ); - } else { - log.info(`Endpoint is unreachable`); - } - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '1'; - }); - } - }); - } catch (err) { - log.info(err); - } -} - -export function getVersions(path: string) { - log.info(`Checking versions from ${path}/package.json`); - - try { - const packages = JSON.parse( - fs.readFileSync(`${path}/package.json`, 'utf8'), - ); - - log.info(`Main package name: ${packages.name}`); - log.info(`Main package version: ${packages.version}`); - if (packages.dependencies) { - log.info(`Dependencies: ${JSON.stringify(packages.dependencies)}`); - } - if (packages.peerDependencies) { - log.info( - `Peer Dependencies: ${JSON.stringify(packages.peerDependencies)}`, - ); - } - if (packages.devDependencies) { - log.info( - `Development Dependencies: ${JSON.stringify( - packages.devDependencies, - )}`, - ); - } - } catch (err) { - log.info( - `An error occurred when trying to read package information from ${path}/package.json`, - ); - } -} diff --git a/packages/integration-sdk-runtime/src/logger/index.ts b/packages/integration-sdk-runtime/src/logger/index.ts index 86499d9f5..f7e2bc0e4 100644 --- a/packages/integration-sdk-runtime/src/logger/index.ts +++ b/packages/integration-sdk-runtime/src/logger/index.ts @@ -376,6 +376,10 @@ export class IntegrationLogger stepFailure(step: StepMetadata, err: Error) { const eventName = 'step_failure'; + this._logger.info( + { errconstructorname: err.constructor?.name }, + 'Error Constructorname', + ); const { errorId, description } = createErrorEventDescription( err, `Step "${step.name}" failed to complete due to error.`, @@ -409,6 +413,10 @@ export class IntegrationLogger validationFailure(err: Error) { const eventName = 'validation_failure'; + this._logger.info( + { errconstructorname: err.constructor?.name }, + 'Error Constructorname', + ); const { errorId, description } = createErrorEventDescription( err, `Error occurred while validating integration configuration.`, From a2ebb799f511a9c3d1d30a8c3f603751042c5569 Mon Sep 17 00:00:00 2001 From: Gonzalo Avalos Ribas Date: Tue, 30 Sep 2025 15:30:13 -0300 Subject: [PATCH 2/2] Remove Troubleshoot command --- packages/integration-sdk-cli/src/commands/index.ts | 1 - packages/integration-sdk-cli/src/index.ts | 2 -- 2 files changed, 3 deletions(-) diff --git a/packages/integration-sdk-cli/src/commands/index.ts b/packages/integration-sdk-cli/src/commands/index.ts index 8ef4473e6..4f8bdb6bd 100644 --- a/packages/integration-sdk-cli/src/commands/index.ts +++ b/packages/integration-sdk-cli/src/commands/index.ts @@ -9,7 +9,6 @@ export * from './validate-question-file'; export * from './neo4j'; export * from './visualize-dependencies'; export * from './generate-integration-graph-schema'; -export * from './troubleshoot'; export * from './generate-ingestion-sources-config'; export * from './generate'; export * from './bocchi'; diff --git a/packages/integration-sdk-cli/src/index.ts b/packages/integration-sdk-cli/src/index.ts index 19632f1e1..7d110b149 100644 --- a/packages/integration-sdk-cli/src/index.ts +++ b/packages/integration-sdk-cli/src/index.ts @@ -13,7 +13,6 @@ import { visualizeDependencies, generateIntegrationGraphSchemaCommand, generateIngestionSourcesConfigCommand, - troubleshootLocalExecution, generate, bocchi, } from './commands'; @@ -32,7 +31,6 @@ export function createCli() { .addCommand(visualizeDependencies()) .addCommand(generateIntegrationGraphSchemaCommand()) .addCommand(generateIngestionSourcesConfigCommand()) - .addCommand(troubleshootLocalExecution()) .addCommand(generate()) .addCommand(bocchi()); }