Error when deploying Azure Spring Apps with "reading 'minReplicas"

NGUYEN PHUC 0 Reputation points
2024-07-27T07:51:26.44+00:00

I previously deployed my spring boot project on Azure successfully with the following application.properties, but now I am receiving an error message:

Failed to deploy app diamondstore
(1/3) Requesting file upload URL... Done 
(2/3) Uploading JAR package... Done 
(3/3) Deploying with new JAR package... 
Failed Cannot read properties of undefined (reading 'minReplicas')

I'm not sure why this is happening, since I am still using the same application.properties file as before. Here is what it looks like:

# server
spring.application.name=diamondStore
spring.datasource.url=jdbc:sqlserver://diamondstore.database.windows.net:1433;database=DiamondStore;user=sqldiamond@diamondstore;password=Diamond12;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2019Dialect
spring.jpa.hibernate.ddl-auto = none
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

# email properties
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=thediamondstore.info24@gmail.com
spring.mail.password=wejvfcekrdeuprph

# SMTP authentication
spring.mail.properties.mail.smtp.auth=true

# STARTTLS encryption
spring.mail.properties.mail.smtp.starttls.enable=true

How can I resolve this error and successfully deploy my app on Azure again

Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
130 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 14,551 Reputation points
    2024-07-27T21:32:01.4133333+00:00

    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:

    1. 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.
    2. 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.
    3. 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.
    4. 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.
    5. Ensure that all your dependencies are correctly configured in your pom.xml or build.gradle file and verify that your application.properties file is correctly formatted and contains the necessary properties for your Spring Boot application.
    6. 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.
    7. 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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.