googlearchive / appengine-nodejs-quickstart Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
I get the following when trying to run locally:
[RalfR@mbp-rr ~/src/appengine-nodejs-quickstart:master] gcloud preview app run .
Usage: gcloud preview [optional flags] <group>
group may be autoscaler | deployment-manager | replica-pools |
resource-views
Manage Preview CLI command groups.
optional flags:
--format FORMAT Format for printed output.
--help Display detailed help.
--project PROJECT Google Cloud Platform project to use for this
invocation.
--quiet, -q Disable all interactive prompts.
-h Print a summary help and exit.
command groups:
autoscaler Manage autoscalers of cloud resources.
deployment-manager Manage Deployments of cloud resources.
replica-pools Manage cloud replica pools.
resource-views Manage Cloud Resource Views.
ERROR: (gcloud.preview) Invalid choice: 'app'.
[RalfR@mbp-rr ~/src/appengine-nodejs-quickstart:master]
Why app.yum
routes to app.js
when it doesn't exist?
Still routes defined in server.js
(e.g. /_ah) are still reached. This makes it a bit weird to understand…
Even the default console.log statement:
console.log('Listening on port 8080');
This might be not project specific, but I think it makes sense to have it work since it's in the example code, thanks!
I installed phantomjs (http://phantomjs.org/) and tried to run it using the node module phantomjs-node (https://github.com/sgentle/phantomjs-node). When I run it on the command line using node directly it runs without issue and I see the output:
The default user agent is Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34
Your Http User Agent string is: SpecialAgent
When I run it with Docker/Managed VMs I see:
Error: Command failed: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 4wLWh: not found
/app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: Nzm8__TEXT: not found
,n@yT: not founds/phantomjs/lib/phantom/bin/phantomjs: 2: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: Epbss`XjAb-mdb
/app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 6: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: Syntax error: ")" unexpected
/app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 4wLWh: not found
/app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: Nzm8__TEXT: not found
,n@yT: not founds/phantomjs/lib/phantom/bin/phantomjs: 2: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: Epbss`XjAb-mdb
/app/node_modules/phantomjs/lib/phantom/bin/phantomjs: 6: /app/node_modules/phantomjs/lib/phantom/bin/phantomjs: Syntax error: ")" unexpected
The code looks like this:
var appengine = require('appengine');
var express = require('express');
var path = require('path');
var childProcess = require('child_process');
var phantomjs = require('phantomjs');
var binPath = phantomjs.path;
var options = {
encoding: 'ascii',
// timeout: 0,
// maxBuffer: 200*1024,
// killSignal: 'SIGTERM',
// cwd: null,
// env: null
};
childProcess.exec("phantomjs ./useragent.js", options, function(err, stdout, stderr) { //highcharts-convert.js -infile ./options1.json -outfile ./chart1.png -scale 2.5 -width 300 -constr Chart -callback ./callback.js
output_message += "
Got return args:
" + err;
output_message += "\n
" + stdout;
output_message += "\n
" + stderr;
console.log(String(output_message));
});
Any idea why the difference or how I get this to work? Thanks!
Can we get an update on this repo? It does not work with nodejs 0.12.
my dir includes
Dockerfile app.yaml package.json server.js static
and static dir has crt and key files
app.yaml has
handlers:
I'm taking options value for https as referred here http://nodejs.org/api/https.html
var options = {
key: fs.readFileSync('static/ssl.key'),
cert: fs.readFileSync('static/ssl.crt')
};
var secureServer = require('https').createServer(options,app).listen(8443);
var server = require('http').createServer(app).listen(8080);
app.get('/', function(req, res) {
res.send('Hello, world ');
});
if i try node server.js
https://localhost:8443 works fine (Identity not verified, as i'm running locally)
but when i try to run this in gcloud preview app run .
only localhost:8080 works https doesn't. (no webpage found.)
How do i get this working? Thanks
I'm trying Logging with appengine.logOneLine(request, message, function(err) { ... });
But can't seem to get it working, lots of errors. If you could show me some examples or add to server.js with logging function that 'd be great!
goog.asserts.assert(value.constructor == field.getNativeType());
^
TypeError: Cannot read property 'constructor' of undefined
at goog.proto2.Message.checkFieldType_ (/Users/sasi/git/node_modules/appengine/lib/closure/goog/proto2/message.js:736:30)
at goog.proto2.Message.set$Value (/Users/sasi/git/node_modules/appengine/lib/closure/goog/proto2/message.js:686:10)
at apphosting.UserAppLogLine.setMessage (/Users/sasi/git/node_modules/appengine/lib/apphosting/api/logservice/log_service.pb.js:214:8)
at makeLogFlushProto (/Users/sasi/git/node_modules/appengine/lib/index.js:571:18)
at AppEngine.logOneLine (/Users/sasi/git/node_modules/appengine/lib/index.js:274:45)
at Object. (/Users/sasi/git/appengine-nodejs-quickstart/server.js:27:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I was able to get the index page with the text "say hello", but when I click and i am getting 503 response
Any hint or idea as to why this keeps failing:
[RalfR@mbp-rr ~/src/appengine-nodejs-quickstart:master] gcloud --project rr-eap preview app deploy --server preview.appengine.google.com .
Updating module [default] from file [/Users/RalfR/src/appengine-nodejs-quickstart/app.yaml]
11:10 AM Host: preview.appengine.google.com
{bucket: vm-containers.rr-eap.appspot.com, path: /containers}
ERROR: Error building docker image rr-eap.default.1
ERROR: {"stream":"Step onbuild-0 : ADD package.json /app/\n"}
ERROR: {"stream":" ---\u003e Using cache\n"}
ERROR: {"stream":" ---\u003e a08b9490e53c\n"}
ERROR: {"stream":"Step onbuild-1 : RUN npm install\n"}
ERROR: {"stream":" ---\u003e Running in f471e2da0533\n"}
ERROR: {"stream":"\u001b[91mnpm\u001b[0m"}
ERROR: {"stream":"\u001b[91m \u001b[0m"}
ERROR: {"stream":"\u001b[91mWARN package.json [email protected] No repository field.\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm \u001b[0m"}
ERROR: {"stream":"\u001b[91mWARN package.json [email protected] No README data\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm\u001b[0m"}
ERROR: {"stream":"\u001b[91m ERR! git clone http://github.com:GoogleCloudPlatform/appengine-nodejs.git\u001b[0m"}
ERROR: {"stream":"\u001b[91m Cloning into bare repository '/.npm/_git-remotes/http-github-com-GoogleCloudPlatform-appengine-nodejs-git-d82c86f8'...\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm ERR!\u001b[0m"}
ERROR: {"stream":"\u001b[91m git clone http://github.com:GoogleCloudPlatform/appengine-nodejs.git \nnpm ERR! git clone http://github.com:GoogleCloudPlatform/appengine-nodejs.git\u001b[0m"}
ERROR: {"stream":"\u001b[91m error: The requested URL returned error: 403 while accessing http://github.com:GoogleCloudPlatform/appengine-nodejs.git/info/refs\nnpm ERR! git clone http://github.com:GoogleCloudPlatform/appengine-nodejs.git fatal: HTTP request failed\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm\u001b[0m"}
ERROR: {"stream":"\u001b[91m ERR! Error: Command failed: error: The requested URL returned error: 403 while accessing http://github.com:GoogleCloudPlatform/appengine-nodejs.git/info/refs\nnpm\u001b[0m"}
ERROR: {"stream":"\u001b[91m ERR! fatal: HTTP request failed\nnpm ERR! \nnpm ERR! at ChildProcess.exithandler (child_process.js:648:15)\nnpm ERR! at ChildProcess.emit (events.js:98:17)\nnpm ERR!\u001b[0m"}
ERROR: {"stream":"\u001b[91m at maybeClose (child_process.js:756:16)\nnpm ERR! at Process.ChildProcess._handle.onexit (child_process.js:823:5)\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm ERR! If you need help, you may report this *entire* log,\nnpm ERR!\u001b[0m"}
ERROR: {"stream":"\u001b[91m including the npm and node versions, at:\nnpm\u001b[0m"}
ERROR: {"stream":"\u001b[91m ERR! \u003chttp://github.com/npm/npm/issues\u003e\n\u001b[0m"}
ERROR: {"stream":"\u001b[91m\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm\u001b[0m"}
ERROR: {"stream":"\u001b[91m ERR! System Linux 3.16.1-tinycore64\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm ERR! command \"/nodejs/bin/node\" \"/nodejs/bin/npm\" \"install\"\nnpm ERR! cwd\u001b[0m"}
ERROR: {"stream":"\u001b[91m /app\nnpm ERR!\u001b[0m"}
ERROR: {"stream":"\u001b[91m \u001b[0m"}
ERROR: {"stream":"\u001b[91mnode -v v0.10.30\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm ERR! npm -v 1.4.21\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm\u001b[0m"}
ERROR: {"stream":"\u001b[91m ERR! code 128\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm \u001b[0m"}
ERROR: {"stream":"\u001b[91mERR!\u001b[0m"}
ERROR: {"stream":"\u001b[91m \nnpm \u001b[0m"}
ERROR: {"stream":"\u001b[91mERR! Additional logging details can be found in:\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm \u001b[0m"}
ERROR: {"stream":"\u001b[91mERR! /app/npm-debug.log\n\u001b[0m"}
ERROR: {"stream":"\u001b[91mnpm \u001b[0m"}
ERROR: {"stream":"\u001b[91mERR! not ok code 0\n\u001b[0m"}
ERROR: {"errorDetail":{"message":"The command [/bin/sh -c npm install] returned a non-zero code: 1"},"error":"The command [/bin/sh -c npm install] returned a non-zero code: 1"}
Traceback (most recent call last):
File "/Users/RalfR/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 150, in <module>
main()
File "/Users/RalfR/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 146, in main
_cli.Execute()
File "/Users/RalfR/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 431, in Execute
post_run_hooks=self.__post_run_hooks, kwargs=kwargs)
File "/Users/RalfR/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py", line 274, in _Execute
pre_run_hooks=pre_run_hooks, post_run_hooks=post_run_hooks)
File "/Users/RalfR/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 882, in Run
result = command_instance.Run(args)
File "/Users/RalfR/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 78, in TryFunc
return func(*args, **kwargs)
File "/Users/RalfR/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 72, in Run
self.__Run(args, project, deployables)
File "/Users/RalfR/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 120, in __Run
path, bucket)
File "/Users/RalfR/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/push.py", line 145, in BuildAndPushDockerImage
nocache=False)) as image, credentials.CredentialsContainer(
File "/Users/RalfR/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 173, in __enter__
self.Build()
File "/Users/RalfR/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 238, in Build
raise ImageError
google.appengine.tools.docker.containers.ImageError
[RalfR@mbp-rr ~/src/appengine-nodejs-quickstart:master]
Hi!
I'm trying to run one websocket using the "ws" module not socket.io. Well, I'm not using an express or other server framework, because my project only require a websocket server. The same code I running over the app engine environment running very good, but when I'm trying to deploy for more test, I receive the 400 http error.
The AppEngine have a limit and I can't using a websocket server running in that?
This is the error I get when running this demo:
google.appengine.tools.devappserver2.wsgi_server.BindError: Unable to bind localhost:8080
Port 8080 is already used on my machine, how do I change it for this app ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.