I'm trying to import @aws-sdk/client-bedrock-runtime
into an AWS Lambda function using NodeJs18 runtime.
This package should be available, because according to AWS docs, "For Node.js versions 18 and later, the Lambda Node.js runtime includes the AWS SDK for JavaScript version 3." source: https://repost.aws/knowledge-center/lambda-layer-aws-sdk-latest-version
When I try it with DynamoDB:
import { DynamoDBClient, ListBackupsCommand } from "@aws-sdk/client-dynamodb";
I get no errors.
But with Bedrock:
import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
I get "errorMessage": "Cannot find package '@aws-sdk/client-bedrock-runtime' imported from /var/task/index.mjs"
.
Is there something different about the Bedrock api that prevents it from being imported into Lambda?
The Node18 Runtime includes SDK version 3.362.0.
@aws-sdk/client-bedrock-runtime
was added in 3.422.0, you'll need to add it manually.