Hello NGUYEN PHUC,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
Problem
I understand that you are having an error while redeploying your Spring Boot project on Azure and the specific error message you're seeing is: "Failed Cannot read properties of undefined (reading 'minReplicas')".
Solution
The error message you're encountering, Cannot read properties of undefined (reading 'minReplicas')
, suggests an issue during the deployment process that may not be directly related to your application.properties
file.
I enlist few things at my fingertips you will need to check to affirm the causes and the solution:
- The error might be related to a misconfiguration in the deployment settings, especially if you're using a platform like Azure App Service, Azure Kubernetes Service (AKS), or a similar deployment mechanism. So, ensure that any deployment configuration files (like Azure's
appsettings.json
or Kubernetes deployment YAML files) are correctly set up and include the necessary properties. - If your application is hosted on a service that requires specific settings (like scaling configurations,
minReplicas
, etc.), make sure these settings are correctly configured in your deployment scripts or portal settings. - Check if there have been any recent changes in your application's codebase that might affect deployment, especially related to scaling or resource management. Ensure that your code does not rely on undefined properties or environment variables.
- While the error doesn't directly relate to your
application.properties
, ensure that your database and mail configurations are correct and secure. For example, storing sensitive information like passwords in plain text is risky. Consider using Azure Key Vault or similar services for secure configuration management. - Ensure that all your dependencies are correctly configured in your
pom.xml
orbuild.gradle
file and verify that yourapplication.properties
file is correctly formatted and contains the necessary properties for your Spring Boot application. - Sometimes, redeploying an existing app can lead to issues due to remnants of previous deployments. Consider creating a new Azure Spring App and deploying your
.jar
file there for the first time. If this works successfully, it might indicate that there are remnants from the previous deployment causing the issue. - As a workaround, you can try deploying your app using the "deploy to Web app" option directly from the Azure portal. Right-click on your resource (subscription, App Service, your app service) and choose this option.
References
Cannot read properties of undefined (reading 'serverInfo') #24088 - GitHub. https://github.com/microsoft/azuredatastudio/issues/24088.
Error when redeploying Azure Spring Apps with "reading 'minReplicas. https://stackoverflow.com/questions/78801035/error-when-redeploying-azure-spring-apps-with-reading-minreplicas.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam