diff --git a/src/commands/local/listeners/arnListener.js b/src/commands/local/listeners/arnListener.js index ba1e095..9b5441b 100644 --- a/src/commands/local/listeners/arnListener.js +++ b/src/commands/local/listeners/arnListener.js @@ -1,12 +1,12 @@ const { v4: uuidv4 } = require('uuid'); +const AWS = require("aws-sdk"); const websocket = require('./websocket'); -let output = console; async function initArnListener(arn, target, compact, sam, replaySettings, func) { const token = uuidv4(); const apiId = await websocket.apiId(); websocket.connect( - `wss://${apiId}.execute-api.${process.env.AWS_REGION}.amazonaws.com/Prod`, + `wss://${apiId}.execute-api.${AWS.config.region}.amazonaws.com/Prod`, token, null, compact, diff --git a/src/commands/local/listeners/localPatternListener.js b/src/commands/local/listeners/localPatternListener.js index e1050a9..49b7404 100644 --- a/src/commands/local/listeners/localPatternListener.js +++ b/src/commands/local/listeners/localPatternListener.js @@ -1,4 +1,5 @@ const fs = require("fs"); +const AWS = require("aws-sdk"); const utils = require("../utils"); const { v4: uuidv4 } = require("uuid"); const YAML = require("yaml-cfn"); @@ -112,7 +113,7 @@ async function initConnection( const token = uuidv4(); websocket.connect( `wss://${await websocket.apiId()}.execute-api.${ - process.env.AWS_REGION + AWS.config.region }.amazonaws.com/Prod`, token, ruleName, diff --git a/src/commands/local/listeners/stackListener.js b/src/commands/local/listeners/stackListener.js index e89b10b..b48965c 100644 --- a/src/commands/local/listeners/stackListener.js +++ b/src/commands/local/listeners/stackListener.js @@ -1,10 +1,11 @@ const { v4: uuidv4 } = require('uuid'); +const AWS = require("aws-sdk"); const websocket = require('./websocket'); async function initStackListener(stackName, compact, sam) { const token = uuidv4(); websocket.connect( - `wss://${await websocket.apiId()}.execute-api.${process.env.AWS_REGION}.amazonaws.com/Prod`, + `wss://${await websocket.apiId()}.execute-api.${AWS.config.region}.amazonaws.com/Prod`, token, stackName, compact, diff --git a/src/commands/local/listeners/websocket.js b/src/commands/local/listeners/websocket.js index e58e94a..f662841 100644 --- a/src/commands/local/listeners/websocket.js +++ b/src/commands/local/listeners/websocket.js @@ -110,7 +110,7 @@ async function apiId(cloudFormationClient) { async function apiUrl() { return `wss://${await apiId()}.execute-api.${ - process.env.AWS_REGION + AWS.config.region }.amazonaws.com/Prod`; } diff --git a/src/commands/replay-dead-letter/replay-util.js b/src/commands/replay-dead-letter/replay-util.js index e1004f6..5ccebc5 100644 --- a/src/commands/replay-dead-letter/replay-util.js +++ b/src/commands/replay-dead-letter/replay-util.js @@ -1,5 +1,4 @@ const AWS = require("aws-sdk"); -const inputUtil = require("../shared/input-util"); const archiveUtil = require("../shared/archive-util"); let eventBridge, sts; diff --git a/src/commands/shared/archive-util.js b/src/commands/shared/archive-util.js index 6cba658..61d3e17 100644 --- a/src/commands/shared/archive-util.js +++ b/src/commands/shared/archive-util.js @@ -1,10 +1,5 @@ const AWS = require("aws-sdk"); const inputUtil = require("./input-util"); -const arnListener = require("../local/listeners/arnListener"); -const fs = require("fs"); -const tempDir = require("temp-dir"); -const path = require("path"); -const { split } = require("temp-dir"); let eventBridge, sts; diff --git a/src/commands/shared/auth-helper.js b/src/commands/shared/auth-helper.js index 5a86a5f..8269735 100644 --- a/src/commands/shared/auth-helper.js +++ b/src/commands/shared/auth-helper.js @@ -3,7 +3,7 @@ require("@mhlabs/aws-sdk-sso"); function initAuth(cmd) { - AWS.config.region = cmd.region || process.env.AWS_REGION || AWS.config.region + AWS.config.region = cmd.region || AWS.config.region || process.env.AWS_REGION const credentials = new AWS.SharedIniFileCredentials({ profile: cmd.profile }); if (credentials.accessKeyId) { AWS.config.credentials = credentials;