21

Getting error while deploying to azure app services from the editor.

4:48:55 pm ppdedsrftwu2-appservice1: Starting deployment...
4:48:56 pm ppdedsrftwu2-appservice1: Creating zip package...
4:49:00 pm ppdedsrftwu2-appservice1: Zip package size: 1.09 MB
4:49:04 pm ppdedsrftwu2-appservice1: Fetching changes.
4:49:06 pm ppdedsrftwu2-appservice1: Updating submodules.
4:49:06 pm ppdedsrftwu2-appservice1: Preparing deployment for commit id '2a73dbd291'.
4:49:06 pm ppdedsrftwu2-appservice1: Repository path is /tmp/zipdeploy/extracted
4:49:06 pm ppdedsrftwu2-appservice1: Running oryx build...
4:49:06 pm ppdedsrftwu2-appservice1: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 10 -i /tmp/8d856447f426192 -p compress_node_modules=tar-gz --log-file /tmp/build-debug.log 
4:49:07 pm ppdedsrftwu2-appservice1: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
4:49:07 pm ppdedsrftwu2-appservice1: You can report issues at https://github.com/Microsoft/Oryx/issues
4:49:07 pm ppdedsrftwu2-appservice1: Oryx Version: 0.2.20200805.1, Commit: e7c39ede513143e9d80fd553f106f04268d770d4, ReleaseTagName: 20200805.1
4:49:07 pm ppdedsrftwu2-appservice1: Build Operation ID: |lvjLop9mFGA=.426fac1c_
4:49:07 pm ppdedsrftwu2-appservice1: Repository Commit : 2a73dbd2834715ba1fee5082d13b60
4:49:07 pm ppdedsrftwu2-appservice1: Detecting platforms...
4:49:07 pm ppdedsrftwu2-appservice1: Could not detect any platform in the source directory.
4:49:07 pm ppdedsrftwu2-appservice1: Error: Couldn't detect a version for the platform 'nodejs' in the repo.
4:49:09 pm ppdedsrftwu2-appservice1: Error: Couldn't detect a version for the platform 'nodejs' in the repo.\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 10 -i /tmp/8d856447f4292 -p compress_node_modules=tar-gz --log-file /tmp/build-debug.log 
4:49:20 pm ppdedsrftwu2-appservice1: Deployment failed.

Have defined all the necessary settings in the portal.

SCM_DO_BUILD_DURING_DEPLOYMENT=true
WEBSITE_NODE_DEFAULT_VERSION=12
WEBSITES_PORT=3000
WEBSITE_HTTPLOGGING_RETENTION_DAYS=7

Tried with node version 10 also but still the same error.

Prateek Naik
  • 2,522
  • 4
  • 18
  • 38

4 Answers4

21

Connected with MS Support team they suggested to make the SCM_DO_BUILD_DURING_DEPLOYMENT= FALSE. After making this as false i am able to deploy the app. But the strange thing is with this option enabled i was doing earlier deployments and it was working.

Prateek Naik
  • 2,522
  • 4
  • 18
  • 38
  • this worked for me, but do you know why? It seems to have started breaking after I upgraded to Angular 10 – Diskdrive Oct 20 '20 at 12:12
  • @Diskdrive No idea why the error came up! For me also the earlier deployments were successful but suddenly this error popping up. After connecting with the support team they mentioned please raise a ticket/issue with `Microsft oryx` GitHub and still waiting for the reason. – Prateek Naik Oct 21 '20 at 07:41
  • 1
    This worked for me but it still very ugly – Christophe Gigax Jul 16 '21 at 10:25
  • 1
    @ChristopheGigax Yes, it is very ugly. Still not able to figure it out :) – Prateek Naik Jul 20 '21 at 03:43
1

In my case, I had the node app in a subdirectory, and this was causing this error in GitHub Actions job. Explicitly setting the working directory in the yml file fixed this. i.e

- name: npm install, build, and test
    working-directory: ./subdirectory
    run: |
      npm install
      npm run build --if-present
      npm run test --if-present
  • this is required for a github deploy and not an ftp deploy. but yes you have to specify the subdirectoy if your root folder for your node is a subfolder in your repo. – Anubis77 Dec 02 '22 at 10:55
1

I also struggled with this issue.

Two things helped me :

When deploying from the Azure App service extension :

  1. Understanding that your root NodeJS application folder must be the root folder that is open in your explorer in vscode.

If your NodeJS application is in a subfolder, azure wont be able to build ( or identify your node platform : hence the error message that you are seeing ) the scripts in your root folder.

By far the easiest way to resolve this is to open vscode in the root folder ( the folder where your package.json file is located.

  • Also : When you click the deploy button on your vscode Azure App service extension : it might allow you to specify the folder to be deployed.

Deploy button location

  1. You can try to add the Application setting : SCM_DO_BUILD_DURING_DEPLOYMENT with the value of FALSE and Deployment slot setting of unchecked.

This is on the azure portal under configuration - application settings - add +

Remember to click that save button after adding new application settings ..... because azure ... lol.

But i think this is mostly way to delay your app building until the files are copied.

Last thing : If you are deploying from Github : Make sure that your nodeJS app is also in the root folder of the Github repo. If it is not you will need to update the workflow file to change the folder to the subfolder.

You just need to add cd yourfoldername above the line where it says npm install and commit the workflow change to the repo.

Hope this helps.

Anubis77
  • 102
  • 1
  • 6
0

If you're doing a deployment from i.e., Visual Studio Code and deploying the dist/... folder then you wouldn't want to try and actually do a build hence setting SCM_DO_BUILD_DURING_DEPLOYMENT=false.

There is not a running node js server to actually do a build on the agent pool deployment pipeline. Azure devops or Jenkins per se would actually have an agent pool to do a "proper (air quotes)" build. Yes, you're code is running on node hence the setting you choose when setting up the web app. So those 2 things are not the same. Rather, DevOps.

I didn't find it in the documentation so appreciate the answer and responses here; but, I just wanted to give more context to the answer.

It's an upgrade to visual studio web apps deployment to potentially utilize other build methods like described in an answer here about github actions.

Christian Matthew
  • 4,014
  • 4
  • 33
  • 43