上下文:
我在将我的节点应用部署到GCP应用引擎时遇到问题。
部署在过去是有效的,但我已经有几个月没有碰过代码了。
部署不会出错,但是当我点击GCP URL时,我得到了一个500服务器错误。
我注意到,在我部署我的版本没有任何示例,我相信它应该有两个示例。
留言内容:
服务器错误服务器遇到错误,无法完成您的请求。请在30秒后重试。
我看了一下日志,其中显示以下内容:
技术栈:
NodeJs、NestJs、Express、GCP、Typescript
错误信息:
错误:找不到模块“/workspace/dist/main”
以下是更多日志:
我不确定他们的一些权限问题,我需要添加。我确实收到了一封关于将我的应用程序从Container Registry迁移到Artifact Registry的电子邮件。所以我不确定这是否会影响到它,或者我需要做什么。
结果:
理想情况下想了解为什么服务器有500错误。日志消息没有帮助。
嵌套生成命令运行后分发文件夹:
部署步骤:
1.我运行npm run set-project:staging来选择要部署到的正确应用引擎。
1.然后我做筑巢。
1.然后我做gcloud应用程序部署。
我的app.yaml文件:
runtime: nodejs16
env: standard
instance_class: F2
env_variables:
GOOGLE_NODE_RUN_SCRIPTS: ''
json包:
{
"name": "backend-app",
"version": "0.0.2",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"main": "dist/main.js",
"scripts": {
"gcp-build": "",
"prebuild": "rimraf dist",
"local-build": "nest build",
"clean": "gts clean",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:prod": "node dist/main",
"start:dev": "nest start --watch",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"set-project:staging": "gcloud config set project hidden-staging",
"deploy:staging": "npm run set-project:staging && npm run local-build && gcloud app deploy",
"deploy:functions:staging": "firebase use staging && firebase deploy --only functions",
"gcloud-login": "gcloud auth application-default login"
},
"engines": {
"node": "16.x"
},
"dependencies": {
"@google-cloud/storage": "^6.2.0",
"@google-cloud/text-to-speech": "^4.0.0",
"@nestjs/cli": "^8.0.0",
"@nestjs/common": "^8.0.0",
"@nestjs/core": "^8.0.0",
"@nestjs/jwt": "^8.0.0",
"@nestjs/passport": "^8.2.1",
"@nestjs/platform-express": "^8.0.0",
"@nestjs/swagger": "^5.2.0",
"@nestjs/throttler": "^2.0.1",
"@ntegral/nestjs-sendgrid": "^1.0.0",
"@sendgrid/mail": "^7.6.1",
"@types/passport": "^1.0.7",
"cookie-parser": "^1.4.6",
"csurf": "^1.11.0",
"firebase": "^9.6.10",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.1",
"passport": "^0.5.2",
"passport-firebase-jwt": "^1.2.1",
"pdf-puppeteer": "^1.1.10",
"puppeteer": "^15.5.0",
"raygun": "^0.13.2",
"reflect-metadata": "^0.1.13",
"request": "^2.88.2",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"swagger-ui-express": "^4.3.0"
},
"devDependencies": {
"@nestjs/schematics": "^8.0.0",
"@nestjs/testing": "^8.0.0",
"@types/cookie-parser": "^1.4.2",
"@types/express": "^4.17.13",
"@types/jest": "^27.0.1",
"@types/node": "^16.0.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"supertest": "^6.1.3",
"ts-jest": "^27.0.3",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "^3.10.1",
"typescript": "^4.3.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
project.toml
[[build.env]]
name = "GOOGLE_NODE_RUN_SCRIPTS"
value = ""
当前错误:
终端好像只说上传2个文件?
浏览器500错误,版本没有示例:
1条答案
按热度按时间tvmytwxo1#
尝试对json包脚本执行以下命令:
文档声明将gcp-build作为空字符串。但是,对于nest build,我们必须在空字符串中添加nest build。
**以上聊天的原始资源:**https:cloud.google.com/appengine/docs/standard/nodejs/release-notes#April_11_2023
app.yaml文件: