Skip to content

Docs: Document that getAppConfig can only be reused for the same AppConfig application & environment #3801

Closed
@HaaLeo

Description

@HaaLeo

What were you searching in the docs?

Subsequent calls to getAppConfig for different applications/environments fail. Looking at its implementation it make sense because the environment as well as the application arguments are cached.

Therefore, something like this fails with some unintuitive "ConfigurationNotFound" error:

import { getAppConfig } from '@aws-lambda-powertools/parameters/appconfig';

// This works just fine
let config = await getAppConfig('config1', {
    environment: 'first',
    application: 'myApp',
    transform: 'json'
});
console.log(config);

// This will throw an error
config = await getAppConfig('config2', {
    environment: 'second',
    application: 'myApp',
    transform: 'json'
});
console.log(config);

Is this related to an existing documentation section?

https://docs.powertools.aws.dev/lambda/typescript/latest/utilities/parameters/#fetching-app-configurations

How can we improve?

Just state that the applications/environment arguments are cached and one has to go with the AppConfigProvider class if one wants to fetch multiple configurations from multiple apps/environments within the same lambda function.

Got a suggestion in mind?

N/A

Acknowledgment

  • I understand the final update might be different from my proposed suggestion, or refused.

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippeddocumentationImprovements or additions to documentationparametersThis item relates to the Parameters Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions