Skip to content

Commit 9520e47

Browse files
committed
save
1 parent 3d43c77 commit 9520e47

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

packages/core/src/shared/env/resolveEnv.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export async function getSpawnEnv(
114114
export async function mergeResolvedShellPath(env: IProcessEnvironment): Promise<typeof process.env> {
115115
const shellEnv = await getResolvedShellEnv(env)
116116
// resolve failed or doesn't need to resolve
117-
if (!shellEnv) {
117+
if (!shellEnv || Object.keys(shellEnv).length === 0) {
118118
return env
119119
}
120120
try {
@@ -139,7 +139,7 @@ export async function mergeResolvedShellPath(env: IProcessEnvironment): Promise<
139139
* - we hit a timeout of `MAX_SHELL_RESOLVE_TIME`
140140
* - any other error from spawning a shell to figure out the environment
141141
*/
142-
export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<typeof process.env | undefined> {
142+
export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<typeof process.env> {
143143
if (!env) {
144144
env = process.env
145145
}

packages/core/src/shared/sam/localLambdaRunner.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { showMessageWithCancel } from '../utilities/messages'
3030
import { ToolkitError, UnknownError } from '../errors'
3131
import { SamCliError } from './cli/samCliInvokerUtils'
3232
import fs from '../fs/fs'
33-
import { asEnvironmentVariables } from '../../auth/credentials/utils'
3433
import { getSpawnEnv } from '../env/resolveEnv'
3534

3635
const localize = nls.loadMessageBundle()
@@ -290,7 +289,6 @@ export async function runLambdaFunction(
290289

291290
const envVars = await getSpawnEnv({
292291
...process.env,
293-
...(config.awsCredentials ? asEnvironmentVariables(config.awsCredentials) : {}),
294292
...(config.aws?.region ? { AWS_DEFAULT_REGION: config.aws.region } : {}),
295293
})
296294

@@ -315,12 +313,13 @@ export async function runLambdaFunction(
315313

316314
// SAM CLI and any API requests are executed in parallel
317315
// A failure from either is a failure for the whole invocation
318-
const [processConst] = await Promise.all([invokeLambdaHandler(timer, envVars, config, settings), apiRequest]).catch(
319-
(err) => {
320-
timer.cancel()
321-
throw err
322-
}
323-
)
316+
const [processInvoker] = await Promise.all([
317+
invokeLambdaHandler(timer, envVars, config, settings),
318+
apiRequest,
319+
]).catch((err) => {
320+
timer.cancel()
321+
throw err
322+
})
324323

325324
if (config.noDebug) {
326325
return config
@@ -329,7 +328,7 @@ export async function runLambdaFunction(
329328
const terminationListener = vscode.debug.onDidTerminateDebugSession((session) => {
330329
const config = session.configuration as SamLaunchRequestArgs
331330
if (config.invokeTarget?.target === 'api') {
332-
stopApi(processConst, config)
331+
stopApi(processInvoker, config)
333332
}
334333
})
335334

0 commit comments

Comments
 (0)