Skip to content

Commit

Permalink
feat(credential-providers): allow usage of fromEnv in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Feb 29, 2024
1 parent 7fd4d55 commit 3a82d4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
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";

0 comments on commit 3a82d4c

Please sign in to comment.