使用Azure DevOps部署Node.js API后Azure Web Service出现应用错误
Azure DevOps部署Node.js API到Azure Web Services遇应用错误排查
我是Azure新手,目前通过Azure DevOps流水线将Node.js API部署至Azure Web Services,部署过程无报错,但访问Azure提供的API URL时,出现如下错误:
:( Application Error If you are the application administrator, you can access the
以下是相关配置文件和项目信息:
azure-pipelines.yml 配置
trigger: - main variables: webAppName: 'api' environmentName: 'api' vmImageName: 'ubuntu-latest' stages: - stage: Build displayName: Build stage jobs: - job: Build displayName: Build pool: vmImage: $(vmImageName) steps: - task: NodeTool@0 inputs: versionSpec: '20.x' displayName: 'Install Node.js' - script: | npm install npm run build --if-present npm run test --if-present displayName: 'npm install, build and test' - task: ArchiveFiles@2 inputs: rootFolderOrFile: '$(System.DefaultWorkingDirectory)' includeRootFolder: false archiveType: zip archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip replaceExistingArchive: true - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip artifact: drop - stage: Deploy displayName: Deploy stage dependsOn: Build condition: succeeded() jobs: - deployment: Deploy displayName: Deploy environment: $(environmentName) pool: vmImage: $(vmImageName) strategy: runOnce: deploy: steps: - task: AzureWebApp@1 displayName: 'Azure Web App Deploy: api' inputs: azureSubscription: $(azureSubscription) appType: webAppLinux appName: $(webAppName) runtimeStack: 'NODE|20.x' package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip startUpCommand: 'node dist/src/services/server.js'
package.json 配置
{ "name": "api", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "node dist/src/services/server.js", "build": "tsc", "dev": "nodemon --exec ts-node src/index.ts", "migrate": "node-pg-migrate", "migrate-up": "DATABASE_URL=$(azureSubscription) npm run migrate up" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "@types/cors": "^2.8.17", "@types/dotenv": "^8.2.0", "@types/multer": "^1.4.11", "bcrypt": "^5.1.1", "cors": "^2.8.5", "dotenv": "^16.4.5", "express": "^4.18.3", "jsonwebtoken": "^9.0.2", "multer": "^1.4.5-lts.1", "pg": "^8.11.3", "typescript": "^5.3.3", "uuid": "^9.0.1" }, "devDependencies": { "@types/express": "^4.17.21", "@types/node": "^20.11.24", "@types/pg": "^8.11.2", "@types/uuid": "^9.0.8", "node-pg-migrate": "^6.2.2", "nodemon": "^3.1.0", "ts-node": "^10.9.2" } }
项目文件结构

麻烦帮忙找出可能的问题,或者提供诊断和解决该问题的步骤,非常感谢!
内容的提问来源于stack exchange,提问作者BugHunter
相关产品推荐
相关产品推荐

