aws-solutions / cloud-migration-factory-on-aws

The Cloud Migration Factory on AWS solution is designed to coordinate and automate manual processes for large-scale migrations. This solution helps enterprises improve performance and prevents long cutover windows by providing an orchestration platform for migrating workloads to AWS at scale.
https://aws.amazon.com/solutions/implementations/cloud-migration-factory-on-aws/
Apache License 2.0
60 stars 63 forks source link

Error on JSON validation for custom attribute #33

Closed asifma closed 5 months ago

asifma commented 7 months ago

Describe the bug When attempting to edit a server in the front-end, an error occurs with the message "Invalid JSON: "[object Object]" is not valid JSON." The issue seems to be related to the initial validation of the JSON attribute when loading the edit page for the server object. The UI gives the indication that something is wrong with the json, but it's not and it further impacts the possibility to save any changes before the validation error is gone.

To Reproduce

  1. Create a custom JSON attribute.
  2. Populate the custom JSON attribute within a CMF Automation job.
  3. Navigate to the front-end and attempt to edit the server with the custom JSON attribute.
  4. Encounter the error: "Invalid JSON: "[object Object]" is not valid JSON."

Expected behavior Editing the server with the custom JSON attribute should not result in a JSON validation error. The JSON object has the correct format, and the validation should not raise an error when loading the edit page.

Please complete the following information about the solution:

Screenshots Screenshot 2024-02-15 at 4 27 21 PM

Additional context Upon further investigation, I believe the issue is related to the initial validation when loading the edit page for the server object. The problem seems to be occurring in the file JsonAttribute.tsx. The validation error disappears when any character is added to a property, indicating that the JSON object is correctly formatted, and the issue might be in the validation process during the initial page load.

abewub commented 7 months ago

Thanks for the filing the bug. I couldn't reproduce it with a simple JSON. We will look into it.

asifma commented 7 months ago

Hi, would be happy to give you more details on slack. Just ping me.

abewub commented 7 months ago

Fix will be included in the next release.

chris-p-baker commented 5 months ago

We have now implemented this fix in v3.3.4.

34