Skip to content

Cannot find module for @aws-sdk/util-retry on Node v18 Lambda runtime #5122

@albertodiazdorado

Description

@albertodiazdorado

Checkboxes for prior research

Describe the bug

I am using AWS Lambda with the Node v18 runtime. I am using several @aws-sdk/* packages, which should be globally available in the Node v18 runtime of AWS Lambda. This holds true for most packages. However, I get this error when trying to use @aws-sdk/util-retry. The code looks like this:

import {
  DynamoDBClient,
  UpdateItemCommand,
  QueryCommand
} from "@aws-sdk/client-dynamodb";
import { ConfiguredRetryStrategy } from "@aws-sdk/util-retry";
import {
  CloudWatchClient,
  PutMetricDataCommand
} from "@aws-sdk/client-cloudwatch";

and the error is:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@aws-sdk/util-retry' imported from /var/task/index.mjs

How can I know in advance which @aws-sdk/* packages are available at runtime and which are not?

cf. #4401

SDK version number

@aws-sdk/util-retry

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

nodejs18.x (whatever AWS Lambda uses)

Reproduction Steps

Use @aws-sdk/util-retry in ESM Node v18 Lambda runtime.

Observed Behavior

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@aws-sdk/util-retry' imported from /var/task/index.mjs

Expected Behavior

Import works

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Labels

closing-soonThis issue will automatically close in 4 days unless further comments are made.response-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions