ms-azuretools-vscode ZipDeploy of production distribution causes Oryx errors

Chandan Datta 0 Reputation points
2025-01-15T05:48:52.0666667+00:00

I am trying to deploy a frontend app to azure app service. When I try to push a zip deploy output of a dist build(using rpm run build) from vscode to nodes runtime azure app service, I get an error below and the app service container stopping in the logs. What is causing this as I am not trying to ask the runtime to build the code(so kudu should just deploy it), although in vscode output it shows the app has been deployed successfully?

Error: Couldn't detect a version for the platform

'nodejs' in the repo.

The app service oryx run command is as follows:

oryx build /tmp/zipdeploy/extracted -0 /home/site/wwwroot --platform nodejs --platform-version 20 -p virtualenv_name= --log-file /tmp/build-debug.10g

-i /tmp/8ds3116e54a3b6 -p compress_node_modules-tar-gz | tee /tmp/oryx-build. 10g

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,243 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,065 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Laxman Reddy Revuri 2,235 Reputation points Microsoft Vendor
    2025-01-15T08:37:42.75+00:00

    Hi @Chandan Datta
    Thanks for the question and using MS Q&A platform.
    apologize for any inconvenience caused on this.
    The error message Error: Couldn't detect a version for the platform typically indicates that the Oryx build process is unable to identify the Node.js version specified for your application. This can happen if the package.json file is missing or if it does not specify a valid Node.js version.

    To resolve this issue, ensure that your package.json file is correctly configured and includes a valid engines field that specifies the Node.js version.
    1.Set Node.js Version:

    Set the WEBSITE_NODE_DEFAULT_VERSION app setting to a stable version (like 16.x) using the Azure CLI:

    az webapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings WEBSITE_NODE_DEFAULT_VERSION="16"
    
    

    2.Ensure All Dependencies Are Included:

    If using TypeScript or other build tools, ensure that all necessary compiled files are included in your deployment package.
    references:
    https://learn.microsoft.com/en-us/azure/app-service/configure-language-nodejs?pivots=platform-windows#troubleshooting
    https://learn.microsoft.com/en-us/azure/static-web-apps/troubleshooting#retrieve-deployment-error-messages

    0 comments No comments

  2. Shree Hima Bindu Maganti 2,745 Reputation points Microsoft Vendor
    2025-01-23T17:45:42.79+00:00

    Hi @Chandan Datta ,
    Thankyou for your Response !
    Laxman's Response with Additional Information,
    The error message "Couldn't detect a version for the platform" indicates that the Oryx build process cannot locate the necessary configuration to identify the Node.js version for your application. This issue often occurs when the deployment expects a Node.js backend but receives a frontend application without the correct configuration files.

    Since you are deploying a simple frontend app, ensure your project structure and configuration files (such as package.json) are properly set up for a static site deployment. Azure Static Web Apps service is optimized for frontend applications and automatically builds them using the Oryx build process.

    To resolve this issue:

    • Ensure your package.json file is present and correctly specifies the necessary scripts for building your frontend app.
    • If using Azure Static Web Apps, follow the specific deployment process for static sites instead of the general App Service deployment.
    • Verify that your repository's folder structure aligns with Azure's expectations for static web apps, particularly the app and api directories if applicable.

    If issues persist, reviewing the logs generated during the build process will provide more insight into the problem.
    Configure a Node.js app for Azure App Service (platform-windows)

    Troubleshooting deployment and runtime errors

    Azure Static Web Apps Frequently Asked Questions
    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.


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.