Skip to content

[bedrock-agent-runtime] Incompatibility with React Native Expo projects #7115

Closed
@jacksonalvarez12

Description

@jacksonalvarez12

Checkboxes for prior research

Describe the bug

This happens in a freshly created expo project. Installing the @aws-sdk/client-bedrock-agent-runtime npm package and then creating a client anywhere in the render tree causes the expo build to crash during bundling.

The resulting error is this:

Android Bundling failed 1377ms node_modules\expo-router\entry.js (1283 modules)
 ERROR  node_modules\@aws-sdk\client-bedrock-agent-runtime\dist-cjs\index.js: C:\[REDACTED]\test-app\node_modules\@aws-sdk\client-bedrock-agent-runtime\dist-cjs\index.js: Static class blocks are not enabled. Please add `@babel/plugin-transform-class-static-block` to your configuration.
  455 |
  456 | // src/BedrockAgentRuntimeClient.ts
> 457 | var BedrockAgentRuntimeClient = class extends import_smithy_client.Client {
      |                                 ^
  458 |   static {
  459 |     __name(this, "BedrockAgentRuntimeClient");
  460 |   }

Weirdly I can't find anything to do with @babel/plugin-transform-class-static-block online other than it being a run of the mill babel package. Either way, this prevents react native expo projects from using the sdk.

Additionally, I checked back as far as 3.787.0 and this still occurred

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?

React Native

Details of the browser/Node.js/ReactNative version

Expo sdk version 53.0.9 - a completely fresh build

Reproduction Steps

Create a new expo app using
npx create-expo-app@latest test-app

cd test-app

npm run android
(This will be a completely functioning template app)

npm install @aws-sdk/client-bedrock-agent-runtime

npm run android
(This will also work)

Now add these lines anywhere in the render tree, I did it in the top most _layout.tsx file

const client = new BedrockAgentRuntimeClient({});
  console.log(`client is defined: ${!!client}`);

npm run android
(This will now fail and show the error I provided above)

Observed Behavior

A build error occurs during android bundling

Android Bundling failed 1377ms node_modules\expo-router\entry.js (1283 modules)
 ERROR  node_modules\@aws-sdk\client-bedrock-agent-runtime\dist-cjs\index.js: C:\[REDACTED]\test-app\node_modules\@aws-sdk\client-bedrock-agent-runtime\dist-cjs\index.js: Static class blocks are not enabled. Please add `@babel/plugin-transform-class-static-block` to your configuration.
  455 |
  456 | // src/BedrockAgentRuntimeClient.ts
> 457 | var BedrockAgentRuntimeClient = class extends import_smithy_client.Client {
      |                                 ^
  458 |   static {
  459 |     __name(this, "BedrockAgentRuntimeClient");
  460 |   }

Expected Behavior

The bundling should succeed, and then show an error at runtime because the client's configuration is empty

Possible Solution

No response

Additional Information/Context

I also tested expo sdk versions 52 and 51, both had the same result

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.p3This is a minor priority issuethird-partyThis issue is related to third-party libraries or applications.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions