Skip to content
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

chore(credential-providers): unavailable browser credential providers throw at runtime #5846

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/credential-providers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ See [`fromSSO()`](#fromsso) fro more information

## `fromEnv()`

- Not available in browser & native apps
- Not available in browser & native apps unless your code or bundler populates the
`process.env` global object.

```javascript
import { fromEnv } from "@aws-sdk/credential-providers"; // ES6 import
Expand Down
3 changes: 3 additions & 0 deletions packages/credential-providers/src/fromEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ import { AwsCredentialIdentityProvider } from "@smithy/types";
* credentials: fromEnv(),
* });
* ```
*
* To use this in non-Node.js environments such as a browser, your code or
* build system must populate the `process.env` global object.
*/
export const fromEnv = (init?: FromEnvInit): AwsCredentialIdentityProvider => _fromEnv(init);
1 change: 1 addition & 0 deletions packages/credential-providers/src/index.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export * from "./fromCognitoIdentity";
export * from "./fromCognitoIdentityPool";
export { fromHttp } from "@aws-sdk/credential-provider-http";
export type { FromHttpOptions, HttpProviderCredentials } from "@aws-sdk/credential-provider-http";
export * from "./fromEnv";
export * from "./fromTemporaryCredentials";
export * from "./fromWebToken";