-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS Bedrock provider doesn't work unless using bedrockOptions
#3018
Comments
Notes while investigating though I don't have a proposed fix yet: I can reproduce the issue. As you suggest, it looks like an Both of your examples (with the noted typo below fixed) work for me locally. In a deployment, the second one seems to execute one query successfully but subsequent queries fail, perhaps due to re-use of a session token intended for refresh (though passing the session token along at all is unintended AFAIK and so part of the bug).
Side note -- there is an extra closing curly brace in your doesn't-work example above. It looks like a typo from removing the
|
For an AI SDK fix, I am wondering whether perhaps we should remove the fallback to It's only the token that's problematic currently, but if we special-case it (don't use its value as a fallback since it can be set outside of the user's control) but leave the others, then we have an API that could surprise a developer. We could prefix the default env var names with |
Yes, I agree it should be renamed as it's already in use by Vercel for other purposes. And many people using this library will encounter that issue. |
Deployments using the Bedrock provider can run in a serverless function that pre-declares a value for `AWS_SESSION_TOKEN` representing an alternate set of credentials than those intended and specified by the developer. If we silently use the environment variable for a default it can create a non-obvious credentials failure that surprises the developer. The session token credentials are less commonly used, and the developer can still pass them along manually (and reference the environment variable themselves if they choose to do so). We also update the documentation to state this behavior as it's admittedly deviant from common practice in the AI SDK providers (but for good reason due to the idiosyncratic way it can be already-present in the serverless environment). Fixes vercel#3018.
Description
This works:
This works when running locally, but not when deploying to Vercel:
I imagine the issue is that Vercel is setting a key that causes the error (https://vercel.com/docs/projects/environment-variables/reserved-environment-variables#allowed-environment-variables). But I didn't manage to track down the error.
bedrockOptions
worked for me though.Code example
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: