Skip to content

[client-lambda] Cannot destructure property 'response' of '(intermediate value)' as it is undefined #7017

Open
@jlowcs

Description

@jlowcs

Checkboxes for prior research

Describe the bug

Cannot destructure property 'response' of '(intermediate value)' as it is undefined is reported to Sentry pretty regularly when using @aws-sdk/client-lambda.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node v22.11.0

Reproduction Steps

Cannot reproduce easily.

We're calling lambda.invoke the following way:

import { Lambda } from '@aws-sdk/client-lambda';
import { NodeHttpHandler } from '@smithy/node-http-handler';

const lambda = new Lambda({
  region: 'us-west-2',
  apiVersion: '2015-03-31',
  requestHandler: new NodeHttpHandler({
    connectionTimeout: 1000,
    socketTimeout: 1000,
  }),
});

// ...

const response = await lambda.invoke({
  FunctionName: longlinksStoreLambdaFunctionName,
  InvocationType: 'RequestResponse',
  LogType: 'None',
  Payload: JSON.stringify({
    body: JSON.stringify({
      url,
      hashLength,
    }),
  }),
});

I just noticed that our apiVersion value is quite old btw.

Observed Behavior

The following error is being reported to Sentry:

Image

Note that this doesn't happen every time, so it "feels" like a race condition.

Expected Behavior

No error

Possible Solution

No response

Additional Information/Context

See also smithy-lang/smithy-typescript#1558

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions