2

I am trying to launch a gcloud app engine using an example in fast-ai with a model that i developped https://github.com/imiled/google-app-engine and followed the instructions in the fastai web page https://course.fast.ai/deployment_google_app_engine.html

but it does not seem to work it raises the following error when i go to the page:

Error: Server Error The server encountered an error and could not complete your request. Please try again in 30 seconds.

here is the log that i got from the console:

miledismael@cloudshell:~/google-app-engine (classification-276710)$ gcloud app browse
Did not detect your browser. Go to this link to view your app:
https://classification-276710.ew.r.appspot.com
miledismael@cloudshell:~/google-app-engine (classification-276710)$ gcloud app logs tail -s default
Waiting for new log entries...
2020-05-11 22:16:26 default[20200512t001309]  "GET / HTTP/1.1" 500
2020-05-11 22:16:28 default[20200512t001309]  internal/modules/cjs/loader.js:983
2020-05-11 22:16:28 default[20200512t001309]    throw err;
2020-05-11 22:16:28 default[20200512t001309]    ^
2020-05-11 22:16:28 default[20200512t001309]
2020-05-11 22:16:28 default[20200512t001309]  Error: Cannot find module '/workspace/server.js'      at Funct
ion.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)      at Function.Module._load (internal/
modules/cjs/loader.js:862:27)      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main
.js:74:12)      at internal/main/run_main_module.js:18:47 {
2020-05-11 22:16:28 default[20200512t001309]    code: 'MODULE_NOT_FOUND',
2020-05-11 22:16:28 default[20200512t001309]    requireStack: []
2020-05-11 22:16:28 default[20200512t001309]  }

If anybody could help that would be great thanks

Lin Du
  • 88,126
  • 95
  • 281
  • 483
ismael miled
  • 21
  • 1
  • 2
  • The error indicates that `'/workspace/server.js'` was not found, and I cannot find it in your github repo as well so I assume is a dependency, maybe you did not install all the requirements on your `requirements.txt`, try running the following: `cat requirements.txt | xargs npm install -g` on your project directory and let me know if it worked. – Ralemos May 12 '20 at 13:13
  • . Hello Yes it s server.js in gcloudI just solved this with – ismael miled May 12 '20 at 16:30
  • Hello Yes it s server.js in gcloud. Actually i just solved this and there were several pb : one is the exactly what you mentioned in requirement : I needed to explicit the version of fastai 1.0.61(needed to be >1.0.6), the other one was that the app needed more resources so i changed the app.yaml file and last one there was a bug in the dictionary reading in the server.py file. Thank you very for your time – ismael miled May 12 '20 at 16:36
  • I have added an answer with what you mentioned above, please remember to accept it, so that the community can refer to that answer if they come across the same issue. – Ralemos May 19 '20 at 10:10

2 Answers2

1

There are 2 problems with your app right now:

  • It does not have all the correct requirements described on requirements.txt installed, try installing it again by running cat requirements.txt | xargs npm install -g

  • As per your mention on the comments, your app needs more resources in the container it's running on, so you should add that to your app.yaml configuration as described on this documentation

Ralemos
  • 5,571
  • 2
  • 9
  • 18
1

The Google Cloud runtime environment for node.js assumes that at start up it should invoke a file called server.js.

If you want to use a different name for your .js file then you can override this default name in either your package.json or app.yaml file.

See https://cloud.google.com/appengine/docs/standard/nodejs/runtime#application_startup

I'm not sure what environment you were running - the fastai web page you linked to doesn't seem to exist now.

But your stack trace looks just like mine, so I'm thinking you probably had the same error as I did - and the fix was to add the start script in package.json.

John Barber
  • 61
  • 1
  • 2