2

After a week of searching, I am not able to find a solution for an app engine deploy issue for my node.js application.

I have come to the point that I have replaced my original code with this "hello world" example for express. Running this in my local dev environment offline works well (as expected).

Then I deploy this app to my google app engine project online using the gcloud cli. That seems to work as well (no errors).

However, when I visit the app online, instead of seeing my app, I see a black page with this message: "Error: Server Error The server encountered an error and could not complete your request. Please try again in 30 seconds.". After some digging in the google cloud console logs, I find that the error seems to be "Error: Cannot find module '/workspace/server.js'" (see more info here). I do not use such a module myself, nor do I define such a path in any of my files.

Does anyone have an idea what might be going wrong and how I can fix it? I have deployed apps successfully recently, but I'm at a loss here...

1

2 Answers 2

1

As Cadet pointed out correctly, the solution was to make some changes to my app.yaml file.

This page allowed me to find the needed handlers.

Thanks a lot, Cadet.

Sign up to request clarification or add additional context in comments.

Comments

1

In my case, I got carried away with my .gcloudignore file

I used .gcloudignore to ignore directories like bin, but I forgot that bin contained the file www which was the file run by my package.json "scripts">"start", this is the entry point for the app to begin running!

 {
  "name": "craft",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www",
  ...

If .gcloudignore ignores a directory, that directory is not deployed to Google App Engine, therefore I got the error (the app couldn't even be run)

Cannot find module '/workspace/bin/www'

(I assume I would get the same error locally if I deleted my bin folder fr my computer, I couldn't run the project locally either)

So the solution was to stop ignoring the bin folder from the deployments; remove (or comment-out) lines like the one below from my .gcloudignore file:

# bin/ <-- we need this folder

I know this is not the solution for the OP (OP says they needed changes to their app.yaml handlers) but it may help other people.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.