anthropics / anthropic-sdk-typescript

Access to Anthropic's safety-first language model APIs
https://www.npmjs.com/package/@anthropic-ai/sdk
MIT License
533 stars 56 forks source link

Bedrock-sdk: Vercel edge runtime not supported #380

Open florianjuengermann opened 3 months ago

florianjuengermann commented 3 months ago

When using the @anthropic-ai/bedrock-sdk in nextjs/vercel edge functions, it fails with

Attempted import error: 'fromNodeProviderChain' is not exported from '@aws-sdk/credential-providers' (imported as 'fromNodeProviderChain').

Import trace for requested module:
./node_modules/.pnpm/@anthropic-ai+bedrock-sdk@0.9.5_encoding@0.1.13/node_modules/@anthropic-ai/bedrock-sdk/auth.mjs

According to the anthropic bedrock-sdk readme, Vercel edge functions are supported.

But in bedrock-sdk/src/auth.ts#L3 fromNodeProviderChain is imported from @aws-sdk/credential-providers which according to their readme, is "Not available in browsers & native apps" and therefore probably not available in the edge runtime.

Are there any trick to get it to run in the edge runtime?

rattrayalex commented 3 months ago

Thanks for raising this, we'll take a look soon.

prajwalpkn commented 2 months ago

Any updates on this?

rattrayalex commented 1 month ago

Sorry we let this slip. I actually think that with AWS's auth system, we won't be able to support bedrock on edge runtimes, but we'll take a look soon and let you know.