2
votes

After making sure that my RESTful API works fine locally, I followed the instructions in the following guide to deploy it: https://cloud.google.com/nodejs/getting-started/hello-world

... and I believe I did it right. I got the following screen after gcloud app deploy finished running.

App Deployment Result - Logs from the Command Line

Sadly, https://_project-id.appspot.com (or gcloud app browse on the command line) keeps leading to a 502 Server Error:

Error: Server Error

The server encountered a temporary error and could not complete your request. Please try again in 30 seconds.

(and yes, I tried again multiple times)

======================================================== Edit: When I checked the Deployment Manager, it says: You don't have any deployments yet.

What would be the problem here?

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"
}

Last part of server.js

// Listen
app.listen(80);

Any ideas what I should do? Thank you very much in advance.

1
What do your logs say? (gcloud app logs read) - Zachary Newman
@Zachary It just repeats: [email protected] start /app node server.js (like in the picture above) - TravelingAries
Any chance that the app is not actually listening, or has died? - jarmod
@jarmod It was listening fine locally.. This is my first time trying to deploy something and I have no idea what the problem is - TravelingAries
Did you ever figure this out? If so please share~! - TeeraMusic

1 Answers

0
votes

As for this problem, I just restructured everything. You can see the files here: https://github.com/edwardjhchang/Jjalkey-Kakao-Talk-Plus-Friend-Auto-Reply-API

Most of all, you must create var http = require('http'); (which I did not realize initially). Check my repository for more details :D