Base solution for your next web application
Open Closed

Errors when deployed to Azure App Service using Azure Devops Pipeline #7910


User avatar
0
dmux created

I have a new project which works in my local Visual Studio debug mode. I used this document https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Setting-Up-an-Azure-Pipeline-Mvc-Core to configure my Azure pipeline. The app builds and deploys, but when I browse to it I see the login page with the wrong font and the "Log In" button does not work. I look at the browser Developer Mode to find errors being thrown like this:

This looks like the problem I first had when I started the project without running yarn or NPM. I have the yarn and NPM in my pipeline definition. Perhaps there is a clue in the output log (in the Pipeline log), because I don't know whether remarks like "The platform "win32" is incompatible with this module" (in the yarn log) are important:

yarn Build Job

##[debug]Getting credentials for local feeds SYSTEMVSSCONNECTION exists true ##[debug]SYSTEMVSSCONNECTION exists true ##[debug]Got auth token ##[debug]System.ServerType=Hosted ##[debug]Agent.ProxyUrl=undefined ##[debug]Getting URI for area ID 4C83CFC1-F33A-477E-A789-29D38FFCA52E from https://-myAzure-.visualstudio.com/ ##[debug]Getting credentials for local feeds SYSTEMVSSCONNECTION exists true ##[debug]SYSTEMVSSCONNECTION exists true ##[debug]Got auth token ##[debug]Agent.ProxyUrl=undefined ##[debug]Acquiring Packaging endpoints from https://-myAzure-.pkgs.visualstudio.com/ ##[debug]Successfully acquired the connection data ##[debug]Acquired location ##[debug]{"PackagingUris":["https://-myAzure-.visualstudio.com/","https://-myAzure-.pkgs.visualstudio.com/","https://pkgsprodeau1.pkgs.visualstudio.com/","https://-myAzure-.pkgs.visualstudio.com/","https://-myAzure-.pkgs.visualstudio.com/","https://pkgs.dev.azure.com/-myAzure-/"],"DefaultPackagingUri":"https://-myAzure-.pkgs.visualstudio.com/"} ##[debug]C:\npm\prefix\yarn.cmd ##[debug]Build.BuildId=1378 ##[debug]Agent.BuildDirectory=d:\a\1 ##[debug]testing directory 'd:\a\1\npm' ##[debug]testing directory 'd:\a\1' ##[debug]mkdir 'd:\a\1\npm' ##[debug]Using registries in .npmrc ##[debug]customEndpoint=null ##[debug]which 'yarn' ##[debug]found: 'C:\npm\prefix\yarn.cmd' ##[debug]which 'yarn' ##[debug]found: 'C:\npm\prefix\yarn.cmd' ##[debug]ProductionMode=false ##[debug]OverridingProjectNpmrc: d:\a\1\s\src\DMux.WebPortal.Web.Mvc.npmrc ##[debug]rm -rf d:\a\1\s\src\DMux.WebPortal.Web.Mvc.npmrc ##[debug]exec tool: C:\npm\prefix\yarn.cmd ##[debug]arguments: C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\yarn.cmd" yarn install v1.19.1 warning package.json: No license field warning [email protected]: No license field [1/4] Resolving packages... [2/4] Fetching packages... warning [email protected]: Unable to read "./man" directory of module "json2" warning [email protected]: Unable to read "./man" directory of module "joosex-simplerequest" warning [email protected]: Unable to read "./man" directory of module "joose" warning [email protected]: Unable to read "./man" directory of module "joosex-namespace-depended" info [email protected]: The platform "win32" is incompatible with this module. info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning " > [email protected]" has incorrect peer dependency "bootstrap@^3.1.1". warning " > [email protected]" has incorrect peer dependency "[email protected]". warning "js-url > [email protected]" has unmet peer dependency "grunt@>=1.0.3". [4/4] Building fresh packages... Done in 63.61s. ##[debug]Exit code 0 received from tool 'C:\npm\prefix\yarn.cmd' ##[debug]STDIO streams have closed for tool 'C:\npm\prefix\yarn.cmd' ##[debug]rm -rf d:\a\1\s\src\DMux.WebPortal.Web.Mvc.npmrc ##[debug]removing file ##[debug]RestoringProjectNpmrc ##[debug]Agent.BuildDirectory=d:\a\1 ##[debug]rm -rf d:\a\1\npm\1378.npmrc ##[debug]removing file ##[debug]task result: Succeeded ##[debug]Processed: ##vso[task.complete result=Succeeded;]Yarn executed successfully ##[debug]Agent.BuildDirectory=d:\a\1 ##[debug]rm -rf d:\a\1\npm ##[debug]removing directory Finishing: Yarn

NPM Build Job

##[debug]Evaluating condition for step: 'NPM Build Job' ##[debug]Evaluating: succeeded() ##[debug]Evaluating succeeded: ##[debug]=> True ##[debug]Result: True Starting: NPM Build Job

Task : Command line Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows Version : 2.151.2 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line

##[debug]VstsTaskSdk 0.9.0 commit 6c48b16164b9a1c9548776ad2062dad5cd543352 ##[debug]Entering D:\a_tasks\CmdLine_d9bafed4-0b18-4f58-968d-86655b4d2ce9\2.151.2\cmdline.ps1. ##[debug]Loading resource strings from: D:\a_tasks\CmdLine_d9bafed4-0b18-4f58-968d-86655b4d2ce9\2.151.2\task.json ##[debug]Loaded 6 strings. ##[debug]SYSTEM_CULTURE: 'en-US' ##[debug]Loading resource strings from: D:\a_tasks\CmdLine_d9bafed4-0b18-4f58-968d-86655b4d2ce9\2.151.2\Strings\resources.resjson\en-US\resources.resjson ##[debug]Loaded 6 strings. ##[debug]INPUT_FAILONSTDERR: 'false' ##[debug] Converted to bool: False ##[debug]INPUT_SCRIPT: 'cd src/DMux.WebPortal.Web.Mvc ##[debug]npm run build' ##[debug]INPUT_WORKINGDIRECTORY: 'd:\a\1\s' ##[debug]Asserting container path exists: 'd:\a\1\s' Generating script. ##[debug]AGENT_VERSION: '2.159.2' ##[debug]AGENT_TEMPDIRECTORY: 'd:\a_temp' ##[debug]Asserting container path exists: 'd:\a_temp' ##[debug]Asserting leaf path exists: 'C:\windows\system32\cmd.exe' ========================== Starting Command Output =========================== ##[debug]Entering Invoke-VstsTool. ##[debug] Arguments: '/D /E:ON /V:OFF /S /C "CALL "d:\a_temp\42efb6de-fddf-4c1d-becb-0056851d297f.cmd""' ##[debug] FileName: 'C:\windows\system32\cmd.exe' ##[debug] WorkingDirectory: 'd:\a\1\s' "C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a_temp\42efb6de-fddf-4c1d-becb-0056851d297f.cmd""

[email protected] build D:\a\1\s\src\DMux.WebPortal.Web.Mvc gulp build

[02:35:56] Using gulpfile D:\a\1\s\src\DMux.WebPortal.Web.Mvc\gulpfile.js [02:35:56] Starting 'build'... [02:37:55] Finished 'build' after 1.97 min ##[debug]Exit code: 0 ##[debug]Leaving Invoke-VstsTool. ##[debug]Leaving D:\a_tasks\CmdLine_d9bafed4-0b18-4f58-968d-86655b4d2ce9\2.151.2\cmdline.ps1. Finishing: NPM Build Job

In my Release definition I have this as the "Package or Folder" to deploy:

$(System.DefaultWorkingDirectory)**\DMux.WebPortal.Web.Mvc.zip

Should I include other files...?

Can someone please point me in the right direction?

  • Kevin

1 Answer(s)
  • User Avatar
    0
    dmux created

    This is now resolved.

    The errors arose because none of the minified .js files were on the app service. I'm guessing that's what NPM does, but i don't know why I wasn't getting them deployed.

    In the end I found that, although I thought it not relevant, I had some differences in my pipeline from the configuration in https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Setting-Up-an-Azure-Pipeline-Mvc-Core

    When I went back and set mine up precisely as that document recommends it works.

    I had used the Pipeline created by Visual Studio "Configure Continuous Depoyment", and adapted it. It uses different tools for the build and test, so there must be some difference there.

    tl;dr: it's resolved.