azure

Hi i'm building to azure static webapp without github actions, when im deploying i get this error: (img) using this .yaml code:
parameters:
- name: variableGroup
- name: variableSecretGroup
- name: templateFile2
- name: environment

jobs:
- deployment: "deploy"
environment: ${{ parameters.environment }}
displayName: "Deploy to ${{parameters.environment}} environment"
variables:
- group: "shared"
- group: "shared-alfabo-frontend"
- group: ${{ parameters.variableGroup }}
- group: ${{ parameters.variableSecretGroup }}
strategy:
runOnce:
deploy:
steps:
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Deploy resources to ${{parameters.environment}} environment'
inputs:
deploymentScope: 'Subscription'
deploymentMode: 'Incremental'
azureResourceManagerConnection: $(azureResourceManagerConnection)
subscriptionId: $(azureSubscriptionId)
location: 'North Europe'
templateLocation: 'Linked artifact'
csmFile: "$(Agent.BuildDirectory)${{ parameters.templateFile2}}.json"
csmParametersFile: "$(Agent.BuildDirectory)${{ parameters.templateFile2}}.parameters.json"
overrideParameters:
'-environmentName "$(environmentName)"
-resourceGroupName "$(resourceGroupName)"
-staticAppName "$(staticAppName)"
-skuCode "$(skuCode)"
-sku "$(sku)"
-vaultName "$(vaultName)"
-location "$(location)"
-deploymentTokenKey "$(deploymentTokenKey)"
-sharedResourceGroupName "$(sharedResourceGroupName)"
-appConfigStoreName "$(appConfigStoreName)"
-domainNames $(domainNames)'

- task: ExtractFiles@1
displayName: 'Extract files'
inputs:
cleanDestinationFolder: true
archiveFilePatterns: $(Agent.BuildDirectory)/drop/output.zip
destinationFolder: '$(Agent.BuildDirectory)/drop/dist'

- task: AzureStaticWebApp@0
displayName: 'Deploy Static Web App'
inputs:
app_location: "/"
api_location: ".output/server"
output_location: ".output/public"
azure_static_web_apps_api_token: '$(deploymentToken)'
parameters:
- name: variableGroup
- name: variableSecretGroup
- name: templateFile2
- name: environment

jobs:
- deployment: "deploy"
environment: ${{ parameters.environment }}
displayName: "Deploy to ${{parameters.environment}} environment"
variables:
- group: "shared"
- group: "shared-alfabo-frontend"
- group: ${{ parameters.variableGroup }}
- group: ${{ parameters.variableSecretGroup }}
strategy:
runOnce:
deploy:
steps:
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Deploy resources to ${{parameters.environment}} environment'
inputs:
deploymentScope: 'Subscription'
deploymentMode: 'Incremental'
azureResourceManagerConnection: $(azureResourceManagerConnection)
subscriptionId: $(azureSubscriptionId)
location: 'North Europe'
templateLocation: 'Linked artifact'
csmFile: "$(Agent.BuildDirectory)${{ parameters.templateFile2}}.json"
csmParametersFile: "$(Agent.BuildDirectory)${{ parameters.templateFile2}}.parameters.json"
overrideParameters:
'-environmentName "$(environmentName)"
-resourceGroupName "$(resourceGroupName)"
-staticAppName "$(staticAppName)"
-skuCode "$(skuCode)"
-sku "$(sku)"
-vaultName "$(vaultName)"
-location "$(location)"
-deploymentTokenKey "$(deploymentTokenKey)"
-sharedResourceGroupName "$(sharedResourceGroupName)"
-appConfigStoreName "$(appConfigStoreName)"
-domainNames $(domainNames)'

- task: ExtractFiles@1
displayName: 'Extract files'
inputs:
cleanDestinationFolder: true
archiveFilePatterns: $(Agent.BuildDirectory)/drop/output.zip
destinationFolder: '$(Agent.BuildDirectory)/drop/dist'

- task: AzureStaticWebApp@0
displayName: 'Deploy Static Web App'
inputs:
app_location: "/"
api_location: ".output/server"
output_location: ".output/public"
azure_static_web_apps_api_token: '$(deploymentToken)'
No description
2 Replies
FiveDigitLP
FiveDigitLP2y ago
It sounds like it's either going to the wrong directory or you don't a index.vue file in the root of your pages folder--at least based on my limited knowledge. 😅 What is your directory structure like? Is your yaml custom or is it generated from Azure? I seem to remember seeing a similar error when I first deployed to Azure SWA and I'm trying to remember how I fixed it.
Talaxasy
Talaxasy2y ago
Try add config_file_location: "/" line to .yaml in the end. Add swa-cli.config.json to your root of project:
{
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"parakeet": {
"appLocation": "src/",
"outputLocation": "dist",
"appBuildCommand": "nuxt generate",
"run": "yarn dev",
"appDevserverUrl": "localhost:3000"
}
}
}
{
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"parakeet": {
"appLocation": "src/",
"outputLocation": "dist",
"appBuildCommand": "nuxt generate",
"run": "yarn dev",
"appDevserverUrl": "localhost:3000"
}
}
}
Add staticwebapp.config.json to root:
{
"platform": {
"apiRuntime": "node:16",
"apiDirectory": ".output/server",
"apiBuildCommand": "yarn run build",
"apiStartCommand": "yarn run nuxt generate && yarn run nuxt start",
"outputDirectory": ".output/public"
},
"routes": [
{
"route": "/index.html",
"redirect": "/"
},
{
"route": "/",
"rewrite": "/api/server"
}
],
"navigationFallback": {
"rewrite": "/api/server"
}
}
{
"platform": {
"apiRuntime": "node:16",
"apiDirectory": ".output/server",
"apiBuildCommand": "yarn run build",
"apiStartCommand": "yarn run nuxt generate && yarn run nuxt start",
"outputDirectory": ".output/public"
},
"routes": [
{
"route": "/index.html",
"redirect": "/"
},
{
"route": "/",
"rewrite": "/api/server"
}
],
"navigationFallback": {
"rewrite": "/api/server"
}
}
Idk, is it necessary or not but and also to root ecosystem.config.js:
module.exports = {
apps: [
{
name: 'Parakeet',
exec_mode: 'cluster',
instances: 'max', // Or a number of instances
script: './.output/server/index.mjs',
args: 'start',
node_args: '-r dotenv/config'
}
]
}
module.exports = {
apps: [
{
name: 'Parakeet',
exec_mode: 'cluster',
instances: 'max', // Or a number of instances
script: './.output/server/index.mjs',
args: 'start',
node_args: '-r dotenv/config'
}
]
}
Want results from more Discord servers?
Add your server