Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LambdaClient InvokeCommand response is missing StatusCode #2021

Closed
thekiwi opened this issue Feb 11, 2021 · 4 comments · Fixed by smithy-lang/smithy-typescript#354 or #2483
Closed
Labels
bug This issue is a bug.

Comments

@thekiwi
Copy link

thekiwi commented Feb 11, 2021

Describe the bug

When executing the LambdaClient send() with an InvokeCommand, the response returned does not include the StatusCode field. The TypeScript definitions suggest it should (and SDK v2 did include it)

Your environment

SDK version number

@aws-sdk/[email protected]

Is the issue in the browser/Node.js/ReactNative?

Node.js

Details of the browser/Node.js/ReactNative version

v12.13.1

Steps to reproduce

Code snippet:

const { LambdaClient, InvokeCommand } = require('@aws-sdk/client-lambda');

const credentials = { accessKeyId: process.env.AKID, secretAccessKey: process.env.SAK };

async function run() {
	const lambda = new LambdaClient({ credentials, region: 'eu-west-1' })

	const params = {
		InvocationType: 'Event',
		FunctionName: 'my_function',
		Payload: JSON.stringify({ foo: 'bar' })
	};
	const command = new InvokeCommand(params);
	const result = await lambda.send(command);
	console.log(JSON.stringify(result, null, 2));
}

run().catch(console.error);

Observed behavior

Here is the output of the above code:

{
  "$metadata": {
    "httpStatusCode": 202,
    "requestId": "00000000-0000-0000-0000-000000000000",
    "attempts": 1,
    "totalRetryDelay": 0
  },
  "Payload": {}
}

You can see it has no StatusCode field at the root level.

Expected behavior

According to the TypeScript definition of InvocationResponse and the API documentation I expect the response payload to include a StatusCode field containing the same as $metadata.httpStatusCode.

Additional context

Tried with both the 'legacy' Lambda class and the newer LambdaClient class, both have the same result.

@thekiwi thekiwi added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 11, 2021
razor-x added a commit to pureskillgg/awsjs that referenced this issue Apr 4, 2021
@razor-x
Copy link

razor-x commented Apr 4, 2021

Can confirm I just hit this and is still an issue with latest version of the sdk.

@ajredniwja
Copy link
Contributor

Seems to be a deserialization issue

,
its under investigation already, I will discuss with the team for a possible fix to be made soon.

@AllanZhengYP
Copy link
Contributor

Hey @thekiwi @ajredniwja this turns out to be an issue with the SDK generator. I pushed a fix in the linked PRs. Thank you a lot for bringing this up!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug.
Projects
None yet
4 participants