node.js - Google Cloud Platform 应用部署导致 502 服务器错误

标签 node.js google-app-engine deployment google-cloud-platform gcloud

在确保我的 RESTful API 在本地正常工作后,我按照以下指南中的说明进行部署: https://cloud.google.com/nodejs/getting-started/hello-world

...我相信我做对了。之后我得到了以下屏幕 gcloud 应用部署 运行完毕。

App Deployment Result - Logs from the Command Line

可悲的是,https://_project-id.appspot.com (或在命令行上使用 gcloud app 浏览)不断导致 502 服务器错误:

错误:服务器错误

服务器遇到临时错误,无法完成您的请求。 请在 30 秒后重试。

(是的,我又尝试了多次)

================================================== ========= 编辑: 当我检查部署管理器时,它说: 您还没有任何部署。

这里会出现什么问题?

app.yaml

# Copyright 2015-2016, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# [START runtime]
runtime: nodejs
env: flex
# [END runtime]

package.json

{
  "name": "plusfriend",
  "version": "1.0.0",
  "description": "Jjalkey Kakao Plus Friend/YellowID RESTful API",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "body-parser": "*",
    "express": "4.14.1",
    "mongoose": "4.8.1",
    "gcloud": "^0.37.0"
  },
  "author": "Edward Joon-Hyuk Chang",
  "license": "ISC"
}

server.js 的最后一部分

// Listen
app.listen(80);

有什么想法我应该做什么吗? 预先非常感谢您。

最佳答案

对于这个问题,我只是重组了一切。您可以在此处查看文件:https://github.com/edwardjhchang/Jjalkey-Kakao-Talk-Plus-Friend-Auto-Reply-API

最重要的是,您必须创建 var http = require('http'); (我最初没有意识到)。检查我的存储库以获取更多详细信息:D

关于node.js - Google Cloud Platform 应用部署导致 502 服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42122057/

相关文章:

javascript - Mongoose 独特的键

node.js - 找不到模块workspace/server.js

java - 如何制作包含DLL的Jar?

visual-studio - 将 UWP 应用从 Visual Studio 部署到 Windows 10 Phone 需要 PIN

node.js - Electron 伪造:据说缺少git和node的依赖项,但都出现在package.json中

javascript - 检查 $routeProvider 模板中是否存在 ng-include 文件

node.js - Golang 从 NodeJS 解密 AES 256 CBC base64

java - 无法通过 Google App Engine 发送带有 zip 附件的邮件

python - Google App Engine 的简单框架(如 Sinatra)?

java - pack200 可以用于单个 java 类吗?