Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1882

Building Svelte Kit application for deployment on Azure webapps

$
0
0

I have built a Svelte Kit application that utilises a couple of Microsoft Graph endpoints to pull from our internal news SharePoint sites. It works perfectly fine in dev and when I use the preview command; however, when it's built and pushed to Azure App Services, I get a "Bad Request" (400).

The build process:

Using the Svelte node-adapter

import adapter from '@sveltejs/adapter-node';export default {    kit: {        adapter: adapter({            out: 'build'        })    }};

When I push a commit to Azure DevOps, it triggers a pipeline run to build the application and push it to Azure.

trigger:  branches:    include:      - mainpool:  vmImage: 'ubuntu-latest'steps:  - task: NodeTool@0    inputs:      versionSpec: '18.x'    displayName: 'Install Node.js'  #install dependencies  - script: |      npm install      npm run build    displayName: 'Install dependencies and build project'  #Copy package.json files to build folder  - script: |      cp package.json build/      cp package-lock.json build/    displayName: 'Copy package files into build directory'  #Install production dependencies in build directory   - script: |      cd build      npm ci --omit=dev    displayName: 'Install production dependencies in build directory'  # Publish the build directory as an artifact  - task: CopyFiles@2    inputs:      SourceFolder: 'build'      Contents: '**'      TargetFolder: '$(Build.ArtifactStagingDirectory)'    displayName: 'Copy build folder to staging directory'  - task: PublishBuildArtifacts@1    inputs:      PathtoPublish: '$(Build.ArtifactStagingDirectory)'      ArtifactName: 'drop'    displayName: 'Publish build artifacts'  # Deploy to Azure App Service (Linux)  - task: AzureWebApp@1    inputs:      azureSubscription: 'ONS'      appName: 'ONS'      package: '$(Build.ArtifactStagingDirectory)'      appType: 'webAppLinux'    displayName: 'Deploy to Azure App Service'

This is what i get when trying to access the web app:

enter image description here

I have the environment variables in the pipeline so that it can build the application, and I have also included them in the webapp. I'm unsure if this is an application problem or a deployment problem. Any insight would be greatly appreciated!

what I've tried:

  • Adding the package.json file from the project
  • Installing the dependencies in the pipline
  • Making the webapp publicly accessible

Viewing all articles
Browse latest Browse all 1882

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>