Application Error trying to deploy site to Azure - node.js

While trying to deploy a simple site in Azure got this error message after deployment:
:( Application Error
If you are the application administrator, you can access the diagnostic resources.
How to solve this problem?

As you are using CI/CD to deploy your application, In the deploy task remove the slot name and replace the package with application file. Below are the samples:
From:
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy#v2
with:
app-name: 'hello-world-app-to-delete'
slot-name: 'production'
publish-profile: $
package: .
To:
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy#v2
with:
app-name: 'hello-world-app-to-delete'
publish-profile: $
package: ./dist/hello-world-app
For more information refer to this GIT blog
And to figure out what is the problem you can enable diagnostics logs in apps for azure app service. Also we can monitor our apps with Azure Application Insights.

Related

Azure SWA deploy with backend resource name

We have our frontend and our backend in Azure and we linked the production environment to our backend successfully. As we deploy this SWA using the default GitHub Action, we were wondering how one would specify the Backend Resource Name. We can link it manually in Azure, but only for static environments. How would one do this for all environments? The docs don't really mention anything here.
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy#v1
with:
deployment_environment: 'develop'
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"

Github Action Build & Deploy .Net Core API & Flutter Web Project to Same Server/Domain

I currently have .Net Core Web API using Github Actions to CI/CD to Azure. (code sample below)
This has been effective for backend work but now am looking to start deploying the front end as well.
The Flutter Web frontend code could either live in the same repo as the API or not which ever is easier to set up - I'm flexible on this point.
I've been trying to figure out what a Github Action YAML would look like to build the Web API backend and also build the Flutter Web Frontend and then deploy them both to the same server/domain
Meaning the end result is:
www.example.com --> would use my flutter web front end
www.example.com/api --> would use my .net core web API backend
Online examples seems to either deploy Flutter apps to Azure Static Webpage or Github Pages which isn't exactly what I'm doing here.
I've seen here how I can built Flutter using actions and can probably save the build artifact created without much issue: How to build Flutter in GitHub Actions CI/CD
But then confused what the configuration would be to deploy both the Flutter and API artifacts. Feeling like perhaps this isn't even possible through Github Actions and maybe need to use Azure DevOps to do something more?
Current Action YAML
name: Build and deploy ASP.Net Core app to Azure Web App - MyApp
on:
push:
branches:
- development
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout#v2
- name: Set up .NET Core
uses: actions/setup-dotnet#v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
- name: Build with dotnet
run: dotnet build --configuration Release
- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
- name: Upload artifact for deployment job
uses: actions/upload-artifact#v2
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
deploy:
runs-on: windows-latest
needs: build
environment:
name: 'Development'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact#v2
with:
name: .net-app
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy#v2
with:
app-name: 'DevMyApp'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_XXXXXXXXXXXXX }}
package: .

Blazor on Azure Linux App Services failing

I am using Azure DevOps to deploy my Blazor WASM to a Linux Web App in Azure AppService.
The deployments succeeded, but the website is not showing the deployed content. I used the same pipeline to deploy to a Windows Web App in App Service and it worked. Is there any issues with Blazor WASM and Azure App Service (Linux). I Ensured that I selected the correct .NET Stack in both Web Apps.
azor
dependsOn: Build_Blazor_App
condition: and(eq(variables['Build.Reason'], 'Manual'), eq('${{parameters.DeployBlazor}}', true) ) # We need deployment to happen only for manual one.
jobs:
- job: Deploy
displayName: Deploy To Azure
steps:
- task: DownloadPipelineArtifact#2
displayName: Downloading Artifacts
inputs:
buildType: 'current'
artifactName: 'blaze'
targetPath: '$(Pipeline.Workspace)'
- task: AzureRmWebAppDeployment#4
displayName: Deploying to Dev
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Az_VS_Enterprise'
appType: 'webAppLinux'
WebAppName: 'smartlytics'
packageForLinux: '$(Pipeline.Workspace)/Smarter.Blazor.zip'
Is there any issues with Blazor WASM and Azure App Service (Linux).
Followed by Microsoft Documentation :
Currently ,To deploy a Standalone Blazor WebAssembly app to Azure app
service on Linux is not supported. A Linux server image to host
the app isn't available at this moment.
We can deploy Blazor WebAssembly apps to Azure App Services on
Windows, which host the apps on IIS .

Bring your own function not available

I was hoping to link my Azure static web app to a function using the Bring your own function feature. However, I don't see the option for my web app:
I have set the api_location to a blank string when deploying the app via GitHub Actions:
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy#v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: 'upload'
app_location: '/'
api_location: ''
What am I missing?
I was using the free plan, and Bring your own functions requires the standard plan. Once I change the hosting plan, the option became available.

Using webapps-deploy to deploy into a specifc folder (not just into wwwroot)

Is it possible to use the webapps-deploy action to deploy into a specific path of the web app (and not just into wwroot)? For example deploying into a IIS virtual directory under wwwroot/app.
Current yaml GitHub action configuration, can't find a property here for setting a requested path on the web server.
- name: "Run Azure webapp deploy action using publish profile credentials"
uses: azure/webapps-deploy#v2
with:
app-name: MyApp
publish-profile: ${{ secrets.SECRET_PROFILE }}
package: build
Image showing the Virtual Application (wwwroot/app) I'd like to deploy into
With many times testing, I found it's not possible using Git Action. But you can consider using Visual Studio, importing publish profile.
First, set the virtual path in portal.
Downloads the publish profile. You will use the content of publish profile.
Modify the profile. Change msdeploySite's value from Your-Site to Your-Site\folder\subfolder, such as msdeploySite="dorissub\app". Change destinationAppUrl's value from http://xxx.azurewebsites.net to http://xxx.azurewebsites.net/app
Publish from VS.
Check the sub folder. it works.
Here is how I do using Git Action.
Add secret. Go to your GitHub repository settings and add a secret with the content of publish profile as the value, name it as AZURE_WEBAPP_PUBLISH_PROFILE.
Run workflow with this yaml file:
name: .NET Core dorisxxx
on: [push]
env:
AZURE_WEBAPP_NAME: dorisxxx # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '3.1.x' # set this to the dot net version to use
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- uses: actions/checkout#master
# Setup .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet#v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# Run dotnet build and publish
- name: dotnet build and publish
run: |
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'
# Deploy to Azure Web apps
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy#v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'
But the project still published to wwwroot...
Maybe you should choose another way to deploy.

Resources