awssdk.services.appconfig.model.BadRequestException

0

hello, in my server,where i use AppConfig sdk ,it's show this error:

software.amazon.awssdk.services.appconfig.model.BadRequestException: Feature flag configurations must be accessed via AWS AppConfig Data's GetLatestConfiguration API. (Service: AppConfig, Status Code: 400, Request ID: 412ba838-95d0-4877-a8a6-c3352bb6731c, Extended Request ID: null)

I have already setup at the backup of website of aws, and there are: appConfig: application: example environment: example configuration: example

can u help me how to setting my java code or give the example guide code for me.

已提問 2 年前檢視次數 983 次
1 個回答
0

Using the Feature Flags configuration type means you need to use the new AppConfigData API instead of the original AppConfig API. The new API works in a slightly different way to the old one:

  • You must call startConfigurationSession before you do anything else with the service. This API call takes the application, environment and profile ids, and returns an initialConfigurationToken, which your application should store.
  • To receive the configuration initially, you call getLatestConfiguration, to which you should pass the stored configuration token. The response to this includes a nextPollConfigurationToken which your application should store. It also includes nextPollIntervalInSeconds, which is the number of seconds your application should wait before requesting the configuration again.
  • You can now call getLatestConfiguration to check for configuration updates. You should supply the most recent nextPollConfigurationToken you received, and store the new one you get in the response to this call. Note that if the configuration has not changed since you last received it, the configuration in the response will be blank. You will also receive a new nextPollIntervalInSeconds (which may be the same value as before), so you should track the new value.

I don't have a Java code sample I'm afraid, but the AppConfig docs show the API call flow using the CLI: https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-retrieving-the-configuration.html

There's also a sample Python AppConfig helper library which implements this API version, which you may find useful to see how it interacts with it: https://github.com/aws-samples/sample-python-helper-aws-appconfig/blob/main/appconfig_helper/appconfig_helper.py

profile pictureAWS
專家
James_S
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南