From 86c19ae387d9971aea36d3e6bd5e1d7c26b72d4a Mon Sep 17 00:00:00 2001 From: Vichym Date: Wed, 23 Apr 2025 16:42:19 -0700 Subject: [PATCH 1/5] add progress status item for invoke actions + tests --- packages/core/package.nls.json | 4 + packages/core/src/lambda/activation.ts | 2 +- .../vue/configEditor/samInvokeBackend.ts | 29 ++- .../vue/configEditor/samInvokeComponent.vue | 4 +- .../vue/configEditor/samInvokeFrontend.ts | 12 +- .../lambda/vue/remoteInvoke/remoteInvoke.vue | 7 +- ...invokeLambda.ts => remoteInvokeBackend.ts} | 80 ++++--- .../vue/remoteInvoke/remoteInvokeFrontend.ts | 7 +- ...okeLambda.test.ts => remoteInvoke.test.ts} | 59 +++-- .../vue/remoteInvoke/remoteInvoke.test.ts | 72 ------ .../src/test/lambda/vue/samInvoke.test.ts | 124 ----------- .../test/lambda/vue/samInvokeBackend.test.ts | 208 +++++++++--------- 12 files changed, 257 insertions(+), 351 deletions(-) rename packages/core/src/lambda/vue/remoteInvoke/{invokeLambda.ts => remoteInvokeBackend.ts} (76%) rename packages/core/src/test/lambda/vue/{remoteInvoke/invokeLambda.test.ts => remoteInvoke.test.ts} (89%) delete mode 100644 packages/core/src/test/lambda/vue/remoteInvoke/remoteInvoke.test.ts delete mode 100644 packages/core/src/test/lambda/vue/samInvoke.test.ts diff --git a/packages/core/package.nls.json b/packages/core/package.nls.json index 9c6ebe66067..feb84b8e03d 100644 --- a/packages/core/package.nls.json +++ b/packages/core/package.nls.json @@ -280,6 +280,10 @@ "AWS.configuration.description.threatComposer.defaultEditor": "Use Threat Composer as the default editor for *.tc.json files.", "AWS.command.accessanalyzer.iamPolicyChecks": "Open IAM Policy Checks", "AWS.lambda.explorerTitle": "Explorer", + "AWS.lambda.local.invoke.progressTitle": "Local Invoke Function", + "AWS.lambda.remote.invoke.progressTitle": "Remote Invoke Function", + "AWS.lambda.invoke.succeed.statusBarMessage": "$(testing-passed-icon) Invoke succeeded: {0}", + "AWS.lambda.invoke.failed.statusBarMessage": "$(testing-failed-icon) Invoke failed: {0}", "AWS.developerTools.explorerTitle": "Developer Tools", "AWS.codewhisperer.explorerTitle": "CodeWhisperer", "AWS.appcomposer.explorerTitle": "Infrastructure Composer", diff --git a/packages/core/src/lambda/activation.ts b/packages/core/src/lambda/activation.ts index d799173697e..6fb34a49823 100644 --- a/packages/core/src/lambda/activation.ts +++ b/packages/core/src/lambda/activation.ts @@ -11,7 +11,7 @@ import { LambdaFunctionNode } from './explorer/lambdaFunctionNode' import { downloadLambdaCommand } from './commands/downloadLambda' import { tryRemoveFolder } from '../shared/filesystemUtilities' import { ExtContext } from '../shared/extensions' -import { invokeRemoteLambda } from './vue/remoteInvoke/invokeLambda' +import { invokeRemoteLambda } from './vue/remoteInvoke/remoteInvokeBackend' import { registerSamDebugInvokeVueCommand, registerSamInvokeVueCommand } from './vue/configEditor/samInvokeBackend' import { Commands } from '../shared/vscode/commands2' import { DefaultLambdaClient } from '../shared/clients/lambdaClient' diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts index 2084ebe82fe..69fdf85f9c3 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts @@ -345,9 +345,10 @@ export class SamInvokeWebview extends VueWebview { } /** - * Validate and execute the provided launch config. + * Validate and execute the provided launch config with a progress indicator in the VS Code window. * TODO: Post validation failures back to webview? * @param config Config to invoke + * @param source Optional source identifier */ public async invokeLaunchConfig(config: AwsSamDebuggerConfiguration, source?: string): Promise { const finalConfig = finalizeConfig( @@ -357,9 +358,31 @@ export class SamInvokeWebview extends VueWebview { const targetUri = await this.getUriFromLaunchConfig(finalConfig) const folder = targetUri ? vscode.workspace.getWorkspaceFolder(targetUri) : undefined - // startDebugging on VS Code goes through the whole resolution chain - await vscode.debug.startDebugging(folder, finalConfig) + // Get function name to display in progress message + let functionName = 'Function' + if (config.invokeTarget.target === 'template' || config.invokeTarget.target === 'api') { + functionName = config.invokeTarget.logicalId + } else if (config.invokeTarget.target === 'code') { + functionName = config.name || config.invokeTarget.lambdaHandler + } + + // Use withProgress in the extension host context + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Window, + title: localize('AWS.lambda.local.invoke.progressTitle', 'Local Invoke Function'), + cancellable: false, + }, + async (progress) => { + // Start debugging + progress.report({ + message: `${functionName}`, + }) + return await vscode.debug.startDebugging(folder, finalConfig) + } + ) } + public async getLaunchConfigQuickPickItems( launchConfig: LaunchConfiguration, uri: vscode.Uri diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue b/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue index 6d64291cff6..f3588c1310f 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue +++ b/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue @@ -12,8 +12,10 @@ class="button-theme-primary" :style="{ width: '20%', marginRight: '27%' }" v-on:click.prevent="launch" + :disabled="invokeInProgress" > - Invoke + Invoking... + Invoke +
+ +
{ } await remoteInvokeWebview.invokeLambda(input) + + const messages = getTestWindow().statusBar.messages + assert.strictEqual(messages.length, 2) + assert.strictEqual(messages[0], 'Remote Invoke Function: testFunction') + assert.strictEqual(messages[1], '$(testing-passed-icon) Invoke succeeded: testFunction') + + // Verify other assertions assert(client.invoke.calledOnce) assert(client.invoke.calledWith(data.FunctionArn, input)) assert.deepStrictEqual(appendedLines, [ @@ -84,6 +95,7 @@ describe('RemoteInvokeWebview', () => { '', ]) }) + it('handles Lambda invocation with no payload', async () => { const mockResponse = { LogResult: Buffer.from('Test log').toString('base64'), @@ -98,6 +110,11 @@ describe('RemoteInvokeWebview', () => { await remoteInvokeWebview.invokeLambda('') + const messages = getTestWindow().statusBar.messages + assert.strictEqual(messages.length, 2) + assert.strictEqual(messages[0], 'Remote Invoke Function: testFunction') + assert.strictEqual(messages[1], '$(testing-passed-icon) Invoke succeeded: testFunction') + assert.deepStrictEqual(appendedLines, [ 'Loading response...', 'Invocation result for arn:aws:lambda:us-west-2:123456789012:function:testFunction', @@ -109,6 +126,7 @@ describe('RemoteInvokeWebview', () => { '', ]) }) + it('handles Lambda invocation with undefined LogResult', async () => { const mockResponse = { Payload: '{"result": "success"}', @@ -122,6 +140,10 @@ describe('RemoteInvokeWebview', () => { } await remoteInvokeWebview.invokeLambda('{}') + const messages = getTestWindow().statusBar.messages + assert.strictEqual(messages.length, 2) + assert.strictEqual(messages[0], 'Remote Invoke Function: testFunction') + assert.strictEqual(messages[1], '$(testing-passed-icon) Invoke succeeded: testFunction') assert.deepStrictEqual(appendedLines, [ 'Loading response...', @@ -134,6 +156,7 @@ describe('RemoteInvokeWebview', () => { '', ]) }) + it('handles Lambda invocation error', async () => { const input = '{"key": "value"}' const mockError = new Error('Lambda invocation failed') @@ -154,6 +177,10 @@ describe('RemoteInvokeWebview', () => { err.message, 'telemetry: invalid Metric: "lambda_invokeRemote" emitted with result=Failed but without the `reason` property. Consider using `.run()` instead of `.emit()`, which will set these properties automatically. See https://github.com/aws/aws-toolkit-vscode/blob/master/docs/telemetry.md#guidelines' ) + const messages = getTestWindow().statusBar.messages + assert.strictEqual(messages.length, 2) + assert.strictEqual(messages[0], 'Remote Invoke Function: testFunction') + assert.strictEqual(messages[1], '$(testing-failed-icon) Invoke failed: testFunction') } assert.deepStrictEqual(appendedLines, [ diff --git a/packages/core/src/test/lambda/vue/remoteInvoke/remoteInvoke.test.ts b/packages/core/src/test/lambda/vue/remoteInvoke/remoteInvoke.test.ts deleted file mode 100644 index d9f3f55fa92..00000000000 --- a/packages/core/src/test/lambda/vue/remoteInvoke/remoteInvoke.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -/*! - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ -import { DefaultLambdaClient, LambdaClient } from '../../../../shared/clients/lambdaClient' -import { RemoteInvokeWebview } from '../../../../lambda/vue/remoteInvoke/invokeLambda' -import * as vscode from 'vscode' -import * as samCliRemoteTestEvent from '../../../../shared/sam/cli/samCliRemoteTestEvent' -import { TestEventsOperation } from '../../../../shared/sam/cli/samCliRemoteTestEvent' -import sinon, { SinonStubbedInstance, createStubInstance } from 'sinon' -import { Lambda } from 'aws-sdk' - -// Tests to check that the internal integration between the functions operates correctly - -describe('RemoteInvokeWebview', function () { - let client: SinonStubbedInstance - let remoteInvokeWebview: RemoteInvokeWebview - let outputChannel: vscode.OutputChannel - let mockData: any - before(async () => { - client = createStubInstance(DefaultLambdaClient) - outputChannel = { - appendLine: (line: string) => {}, - show: () => {}, - } as vscode.OutputChannel - mockData = { - FunctionArn: 'arn:aws:lambda:us-west-2:123456789012:function:my-function', - } - remoteInvokeWebview = new RemoteInvokeWebview(outputChannel, client, mockData) - }) - describe('Invoke Remote Lambda Function with Payload', () => { - it('should invoke with a simple payload', async function () { - const input = '{"key": "value"}' - const mockResponse: Lambda.InvocationResponse = { - LogResult: Buffer.from('Test log').toString('base64'), - Payload: '{"result": "success"}', - } - client.invoke.resolves(mockResponse) - await remoteInvokeWebview.invokeLambda(input) - sinon.assert.calledOnce(client.invoke) - sinon.assert.calledWith(client.invoke, mockData.FunctionArn, input) - }) - }) - describe('Invoke Remote Lambda Function with Saved Events Payload', () => { - const mockEvent = { - name: 'TestEvent', - arn: 'arn:aws:lambda:us-west-2:123456789012:function:myFunction', - region: 'us-west-2', - } - const expectedParams = { - name: mockEvent.name, - operation: TestEventsOperation.Get, - functionArn: mockEvent.arn, - region: mockEvent.region, - } - const mockResponse = 'true' - let runSamCliRemoteTestEventsStub: sinon.SinonStub - beforeEach(() => { - runSamCliRemoteTestEventsStub = sinon.stub(samCliRemoteTestEvent, 'runSamCliRemoteTestEvents') - }) - afterEach(() => { - sinon.restore() - }) - it('should get saved event and invoke with it', async function () { - runSamCliRemoteTestEventsStub.resolves(mockResponse) - await remoteInvokeWebview.getRemoteTestEvents(mockEvent) - - sinon.assert.calledOnce(runSamCliRemoteTestEventsStub) - sinon.assert.calledWith(runSamCliRemoteTestEventsStub, expectedParams) - }) - }) -}) diff --git a/packages/core/src/test/lambda/vue/samInvoke.test.ts b/packages/core/src/test/lambda/vue/samInvoke.test.ts deleted file mode 100644 index ad8c0a2eafe..00000000000 --- a/packages/core/src/test/lambda/vue/samInvoke.test.ts +++ /dev/null @@ -1,124 +0,0 @@ -/*! - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -import assert from 'assert' -import { finalizeConfig } from '../../../lambda/vue/configEditor/samInvokeBackend' -import { AwsSamDebuggerConfiguration } from '../../../shared/sam/debugger/awsSamDebugConfiguration' - -describe('Sam Invoke Vue Backend', () => { - describe('finalizeConfig', () => { - it('prunes configs correctly', () => { - const configs: { input: AwsSamDebuggerConfiguration; output: AwsSamDebuggerConfiguration }[] = [ - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'noprune', - type: 'aws-sam', - request: 'direct-invoke', - }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'noprune', - type: 'aws-sam', - request: 'direct-invoke', - }, - }, - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - lambda: { - payload: { - json: {}, - }, - }, - name: 'prunejson', - type: 'aws-sam', - request: 'direct-invoke', - }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunejson', - type: 'aws-sam', - request: 'direct-invoke', - }, - }, - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunestr', - type: 'aws-sam', - request: 'direct-invoke', - lambda: { - runtime: '', - }, - }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunestr', - type: 'aws-sam', - request: 'direct-invoke', - }, - }, - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunearr', - type: 'aws-sam', - request: 'direct-invoke', - lambda: { - pathMappings: [], - }, - }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunearr', - type: 'aws-sam', - request: 'direct-invoke', - }, - }, - ] - - for (const config of configs) { - assert.deepStrictEqual( - finalizeConfig(config.input, config.input.name), - config.output, - `Test failed for input: ${config.input.name}` - ) - } - }) - }) -}) diff --git a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts index cbad9bfff55..ddb3f85cd45 100644 --- a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts +++ b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts @@ -24,7 +24,7 @@ import { getTestWindow } from '../..' import * as samInvokeBackend from '../../../lambda/vue/configEditor/samInvokeBackend' import sinon from 'sinon' import * as nls from 'vscode-nls' -import { assertLogsContain } from '../../../test/globalSetup.test' +import { assertLogsContain } from '../../globalSetup.test' import { createResponse } from '../../testUtil' const localize = nls.loadMessageBundle() @@ -228,123 +228,121 @@ describe('SamInvokeWebview', () => { assert.strictEqual(result, undefined) }) }) - describe('Sam Invoke Vue Backend', () => { - describe('finalizeConfig', () => { - it('prunes configs correctly', () => { - const configs: { input: AwsSamDebuggerConfiguration; output: AwsSamDebuggerConfiguration }[] = [ - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'noprune', - type: 'aws-sam', - request: 'direct-invoke', + describe('finalizeConfig', () => { + it('prunes configs correctly', () => { + const configs: { input: AwsSamDebuggerConfiguration; output: AwsSamDebuggerConfiguration }[] = [ + { + input: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'noprune', - type: 'aws-sam', - request: 'direct-invoke', + name: 'noprune', + type: 'aws-sam', + request: 'direct-invoke', + }, + output: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', }, + name: 'noprune', + type: 'aws-sam', + request: 'direct-invoke', }, - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - lambda: { - payload: { - json: {}, - }, - }, - name: 'prunejson', - type: 'aws-sam', - request: 'direct-invoke', + }, + { + input: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', + lambda: { + payload: { + json: {}, }, - name: 'prunejson', - type: 'aws-sam', - request: 'direct-invoke', }, + name: 'prunejson', + type: 'aws-sam', + request: 'direct-invoke', }, - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunestr', - type: 'aws-sam', - request: 'direct-invoke', - lambda: { - runtime: '', - }, + output: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunestr', - type: 'aws-sam', - request: 'direct-invoke', + name: 'prunejson', + type: 'aws-sam', + request: 'direct-invoke', + }, + }, + { + input: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', + }, + name: 'prunestr', + type: 'aws-sam', + request: 'direct-invoke', + lambda: { + runtime: '', }, }, - { - input: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunearr', - type: 'aws-sam', - request: 'direct-invoke', - lambda: { - pathMappings: [], - }, + output: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', }, - output: { - invokeTarget: { - target: 'template', - logicalId: 'foobar', - templatePath: 'template.yaml', - }, - name: 'prunearr', - type: 'aws-sam', - request: 'direct-invoke', + name: 'prunestr', + type: 'aws-sam', + request: 'direct-invoke', + }, + }, + { + input: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', + }, + name: 'prunearr', + type: 'aws-sam', + request: 'direct-invoke', + lambda: { + pathMappings: [], }, }, - ] + output: { + invokeTarget: { + target: 'template', + logicalId: 'foobar', + templatePath: 'template.yaml', + }, + name: 'prunearr', + type: 'aws-sam', + request: 'direct-invoke', + }, + }, + ] - for (const config of configs) { - assert.deepStrictEqual( - finalizeConfig(config.input, config.input.name), - config.output, - `Test failed for input: ${config.input.name}` - ) - } - }) + for (const config of configs) { + assert.deepStrictEqual( + finalizeConfig(config.input, config.input.name), + config.output, + `Test failed for input: ${config.input.name}` + ) + } }) }) - describe('SamInvokeWebview - getSamLaunchConfigs', function () { + describe('getSamLaunchConfigs', function () { let workspaceFoldersStub: sinon.SinonStub let launchConfigStub: sinon.SinonStub let getLaunchConfigQuickPickItemsStub: sinon.SinonStub @@ -554,14 +552,14 @@ describe('SamInvokeWebview', () => { assert.strictEqual(result, undefined) }) }) - describe('InvokeLocalWebview', function () { + describe('invokeLaunchConfig', function () { let sandbox: sinon.SinonSandbox let mockFolder: vscode.WorkspaceFolder let mockUri: vscode.Uri let getUriFromLaunchConfigStub: sinon.SinonStub let workspaceFoldersStub: sinon.SinonStub - this.beforeEach(async function () { + beforeEach(async function () { sandbox = sinon.createSandbox() mockFolder = createMockWorkspaceFolder('/mock-path') mockUri = mockFolder.uri @@ -583,6 +581,10 @@ describe('SamInvokeWebview', () => { const startDebuggingStub = sandbox.stub(vscode.debug, 'startDebugging').resolves(true) await samInvokeWebview.invokeLaunchConfig(mockConfig) + const messages = getTestWindow().statusBar.messages + assert.strictEqual(messages.length, 2) + assert.strictEqual(messages[0], 'Remote Invoke Function: testFunction') + assert.strictEqual(messages[1], '$(testing-failed-icon) Invoke failed: testFunction') assert(startDebuggingStub.called) }) From 53627edfeb5b86bc9ce906712747e7eb06c357c2 Mon Sep 17 00:00:00 2001 From: Vichym Date: Mon, 28 Apr 2025 15:50:04 -0700 Subject: [PATCH 2/5] update invoke status message and add change log --- packages/core/package.nls.json | 3 ++- .../core/src/lambda/vue/configEditor/samInvokeBackend.ts | 8 ++++++++ .../src/lambda/vue/remoteInvoke/remoteInvokeBackend.ts | 2 +- .../core/src/test/lambda/vue/samInvokeBackend.test.ts | 4 ++-- .../Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json | 4 ++++ 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json diff --git a/packages/core/package.nls.json b/packages/core/package.nls.json index feb84b8e03d..6b666256508 100644 --- a/packages/core/package.nls.json +++ b/packages/core/package.nls.json @@ -282,7 +282,8 @@ "AWS.lambda.explorerTitle": "Explorer", "AWS.lambda.local.invoke.progressTitle": "Local Invoke Function", "AWS.lambda.remote.invoke.progressTitle": "Remote Invoke Function", - "AWS.lambda.invoke.succeed.statusBarMessage": "$(testing-passed-icon) Invoke succeeded: {0}", + "AWS.lambda.invoke.succeeded.statusBarMessage": "$(testing-passed-icon) Invoke succeeded: {0}", + "AWS.lambda.invoke.completed.statusBarMessage": "$(testing-passed-icon) Invoke completed: {0}", "AWS.lambda.invoke.failed.statusBarMessage": "$(testing-failed-icon) Invoke failed: {0}", "AWS.developerTools.explorerTitle": "Developer Tools", "AWS.codewhisperer.explorerTitle": "CodeWhisperer", diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts index 69fdf85f9c3..685643946b6 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts @@ -381,6 +381,14 @@ export class SamInvokeWebview extends VueWebview { return await vscode.debug.startDebugging(folder, finalConfig) } ) + vscode.window.setStatusBarMessage( + localize( + 'AWS.lambda.invoke.completed.statusBarMessage', + '$(testing-passed-icon) Invoke completed: {0}', + functionName + ), + 5000 + ) } public async getLaunchConfigQuickPickItems( diff --git a/packages/core/src/lambda/vue/remoteInvoke/remoteInvokeBackend.ts b/packages/core/src/lambda/vue/remoteInvoke/remoteInvokeBackend.ts index e691db33f47..209a61023de 100644 --- a/packages/core/src/lambda/vue/remoteInvoke/remoteInvokeBackend.ts +++ b/packages/core/src/lambda/vue/remoteInvoke/remoteInvokeBackend.ts @@ -122,7 +122,7 @@ export class RemoteInvokeWebview extends VueWebview { vscode.window.setStatusBarMessage( result === 'Succeeded' ? localize( - 'AWS.lambda.invoke.succeed.statusBarMessage', + 'AWS.lambda.invoke.succeeded.statusBarMessage', '$(testing-passed-icon) Invoke succeeded: {0}', this.data.FunctionName ) diff --git a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts index ddb3f85cd45..561da31b32f 100644 --- a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts +++ b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts @@ -583,8 +583,8 @@ describe('SamInvokeWebview', () => { await samInvokeWebview.invokeLaunchConfig(mockConfig) const messages = getTestWindow().statusBar.messages assert.strictEqual(messages.length, 2) - assert.strictEqual(messages[0], 'Remote Invoke Function: testFunction') - assert.strictEqual(messages[1], '$(testing-failed-icon) Invoke failed: testFunction') + assert.strictEqual(messages[0], 'Local Invoke Function: foobar') + assert.strictEqual(messages[1], '$(testing-passed-icon) Invoke completed: foobar') assert(startDebuggingStub.called) }) diff --git a/packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json b/packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json new file mode 100644 index 00000000000..aa8326902e9 --- /dev/null +++ b/packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json @@ -0,0 +1,4 @@ +{ + "type": "Feature", + "description": "Lambda: add progress status item for Lambda invoke actions" +} From 5a33c4d992b57e51ee3cff9f210191bf38fe70df Mon Sep 17 00:00:00 2001 From: vicheey <181402101+vicheey@users.noreply.github.com> Date: Thu, 8 May 2025 13:05:49 -0700 Subject: [PATCH 3/5] Update packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json --- .../Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json b/packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json index aa8326902e9..89221400b79 100644 --- a/packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json +++ b/packages/toolkit/.changes/next-release/Feature-dd85e352-be76-4b69-8225-03b4e784ca10.json @@ -1,4 +1,4 @@ { "type": "Feature", - "description": "Lambda: add progress status item for Lambda invoke actions" + "description": "Lambda: add progress status item for Lambda local invoke and remote invoke actions" } From 50f32da6540a0bae74eeaefa420211d99abe7d35 Mon Sep 17 00:00:00 2001 From: vicheey <181402101+vicheey@users.noreply.github.com> Date: Thu, 8 May 2025 13:06:06 -0700 Subject: [PATCH 4/5] Update packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts --- packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts index d5dfe037a2c..476e2f5b0f4 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts @@ -179,7 +179,7 @@ export default defineComponent({ // Instead of using vscode.window.withProgress directly, delegate to the backend await client.invokeLaunchConfig(config, source) } catch (e: any) { - console.error(`invokeLaunchConfig failed: ${e.message}`) + console.error("invokeLaunchConfig failed", e) } finally { this.invokeInProgress = false } From 7358da5fce56727a8d083ade7065cf1457f7f53f Mon Sep 17 00:00:00 2001 From: vicheey <181402101+vicheey@users.noreply.github.com> Date: Thu, 8 May 2025 13:06:25 -0700 Subject: [PATCH 5/5] Update packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts --- packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts index 476e2f5b0f4..564b85a1057 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts @@ -178,7 +178,7 @@ export default defineComponent({ try { // Instead of using vscode.window.withProgress directly, delegate to the backend await client.invokeLaunchConfig(config, source) - } catch (e: any) { + } catch (e) { console.error("invokeLaunchConfig failed", e) } finally { this.invokeInProgress = false