-
Notifications
You must be signed in to change notification settings - Fork 864
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
[ERRORS] Issue with AWS SDK for java when adding a new feature flag to existing configuration Profile(short issue description) #5465
Comments
Transferring to the Java SDK v2 repo. |
@debora-ito Can you send me the link of the thread after transfer or this is the thread I need to watch out? Also, this is Java SDK v2 right? |
@prashanthparsi can you generate the verbose wirelogs? Maybe we can see the reason why the content is malformed. Refer to our Dev Guide for instructions - https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/logging-slf4j.html#sdk-java-logging-verbose |
Not much info from the verbose logs either 11:04:14.675 [main] DEBUG software.amazon.awssdk.core.interceptor.ExecutionInterceptorChain - Creating an interceptor chain that will apply interceptors in the following order: [software.amazon.awssdk.core.internal.interceptor.HttpChecksumValidationInterceptor@16ecee1, software.amazon.awssdk.awscore.interceptor.HelpfulUnknownHostExceptionInterceptor@3b220bcb, software.amazon.awssdk.awscore.eventstream.EventStreamInitialRequestInterceptor@2b95e48b, software.amazon.awssdk.awscore.interceptor.TraceIdExecutionInterceptor@4a3329b9, software.amazon.awssdk.services.appconfigdata.auth.scheme.internal.AppConfigDataAuthSchemeInterceptor@3dddefd8, software.amazon.awssdk.services.appconfigdata.endpoints.internal.AppConfigDataResolveEndpointInterceptor@160ac7fb, software.amazon.awssdk.services.appconfigdata.endpoints.internal.AppConfigDataRequestSetEndpointInterceptor@12bfd80d] amz-sdk-invocation-id:d1b2b863-d7e5-603f-a8a3-6a92d8fe41d0 amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token amz-sdk-invocation-id;amz-sdk-request;host;x-amz-content-sha256;x-amz-date;x-amz-security-token amz-sdk-invocation-id:4624a399-45d0-6399-8e59-5de2ee95df66 amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token Process finished with exit code 0 |
I also infact logged json content and its matching with json schema. https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-type-reference-feature-flags.html 11:22:30.579 [main] INFO com.adp.talent.AppConfigWriteExample - JSON content being submitted: {"values":{"flag_from_ui":{"_createdAt":"2024-08-05T19:55:27.399Z","_updatedAt":"2024-08-05T19:55:27.399Z","enabled":true},"ui_refresh":{"_createdAt":"2024-08-05T17:59:42.886Z","_updatedAt":"2024-07-31T18:09:19.939Z","enabled":false}},"flags":{"flag_from_ui":{"_createdAt":"2024-08-05T19:55:27.399Z","name":"flag_from_ui","description":"flag_from_ui","_updatedAt":"2024-08-05T19:55:27.399Z"},"ui_refresh":{"_createdAt":"2024-08-05T17:59:42.886Z","name":"UI Refresh","_updatedAt":"2024-07-31T18:09:19.939Z"}},"version":"1"} Formatted one -> {
"values":
{
"flag_from_ui":
{
"_createdAt": "2024-08-05T19:55:27.399Z",
"_updatedAt": "2024-08-05T19:55:27.399Z",
"enabled": true
},
"ui_refresh":
{
"_createdAt": "2024-08-05T17:59:42.886Z",
"_updatedAt": "2024-07-31T18:09:19.939Z",
"enabled": false
}
},
"flags":
{
"flag_from_ui":
{
"_createdAt": "2024-08-05T19:55:27.399Z",
"name": "flag_from_ui",
"description": "flag_from_ui",
"_updatedAt": "2024-08-05T19:55:27.399Z"
},
"ui_refresh":
{
"_createdAt": "2024-08-05T17:59:42.886Z",
"name": "UI Refresh",
"_updatedAt": "2024-07-31T18:09:19.939Z"
}
},
"version": "1"
} |
@prashanthparsi in the wirelogs you shared the credential keys and security token, I removed from your comment but they are still available in the comment history. Please rotate your credentials as soon as possible. I'll take a look at the logs shortly. |
Here's the relevant request:
Here's how the content body is being sent in the wire:
According to the AppConfig CreateHostedConfigurationVersion API Reference:
Have you tried sending the content in JSON text format? Just to rule out any issues with encoding. If sending in text format still returns Malformed Content error, I'll reach out to the AppConfig team internally, I'll ask you to share a fresh request ID to send them. |
@debora-ito I figured it out. I changed the way the content is encoded. For better understanding I commented old code, and new code is working. I have updated the code to use CreateHostedConfigurationVersionRequest createHostedConfigRequest = CreateHostedConfigurationVersionRequest.builder()
.applicationId(APP_ID)
.configurationProfileId(CONFIG_PROFILE_ID)
.content(SdkBytes.fromString(updatedContent, StandardCharsets.UTF_8))
// .content(SdkBytes.fromByteArray(base64EncodedContent.getBytes(StandardCharsets.UTF_8)))
.contentType("application/json")
.build(); |
Glad you're not blocked anymore. Closing. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Upcoming End-of-Support
Describe the bug
I have been trying to leverage AWS SDK for java for putting a new feature flag into the existing configuration profile. So far I have no luck in getting the code working. I tried multiple ways, read all the available AWS documentation (although its shame that there isn't much), but still I am unable to resolve the code issue. I debugged AWS SDK too, but no luck. I hope I can get resolution here. I tried with Python and Java SDK but both have same issue.
Here is the use case. I need to add a new flag to existing configuration. The below is test code from my local but production grade code yet. I just want to try out before I refactor it.
Expected Behavior
The feature flag should be persisted under the given application and configuration profile.
Current Behavior
software.amazon.awssdk.services.appconfig.model.BadRequestException: Error invoking extension AppConfig Feature Flags Helper: Malformed 'Content' provided (Service: AppConfig, Status Code: 400,
Reproduction Steps
Run the below code.
Possible Solution
No response
Additional Information/Context
I have been trying to leverage AWS SDK for java for putting a new feature flag into the existing configuration profile. So far I have no luck in getting the code working. I tried multiple ways, read all the available AWS documentation (although its shame that there isn't much), but still I am unable to resolve the code issue. I debugged AWS SDK too, but no luck. I hope I can get resolution here. I tried with Python and Java SDK but both have same issue.
Here is the use case. I need to add a new flag to existing configuration. The below is test code from my local but production grade code yet. I just want to try out before I refactor it.
Code running on Java 17 and AWS SDK V2
Here is the code ->
Here is the actual json it converts to, which matches with AWS Schema: https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-type-reference-feature-flags.html
Here is the error I am getting while running this code ->
Any help or pointers will unblock me. Need ASAP
AWS Java SDK version used
2.26.25
JDK version used
java version "17.0.4.1" 2022-08-18 LTS
Java(TM) SE Runtime Environment (build 17.0.4.1+1-LTS-2)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.4.1+1-LTS-2, mixed mode, sharing)
Operating System and version
macOS Sonama 14.5
The text was updated successfully, but these errors were encountered: