Closed evanhuang8 closed 9 years ago
slc -v
output?--harmony
?I recommend looking at https://iojs.org/en/es6.html, particularly
On Node.js™@0.12.x (V8 3.28+), the --harmony runtime flag enables all completed, staged and in progress ES6 features together, in bulk (with the exception of proxies which are hidden under --harmony-proxies). This means that some really buggy or even broken [...]
If I can repro, I'll take a quick look, and if there is an easy tweak, I'll make it, but we don't test with --harmony
, and I'm not sure we will commit to supporting it.
Either way, I would STRONGLY recommend against using --harmony
. If you are using io.js, use only es6 features that are available in "strict mode", and if you are on an earlier node, use https://www.npmjs.com/package/6to5.
fwiw, I cannot repro with https://github.com/strongloop/express-example-app, and a locally installed supervisor:
% node --harmony ./node_modules/.bin/sl-run server.js
INFO strong-agent v1.6.21 profiling app 'express-example-app' pid '4454'
INFO strong-agent[4454] started profiling agent
INFO supervisor reporting metrics to `internal:`
supervisor running without clustering (unsupervised)
Listening on port: 3000
Thanks for the prompt reply.
Here is the slc -v
output:
strongloop v4.0.5 (node v0.12.0)
├── strong-arc@1.4.4 (889bc42)
├── strong-build@2.0.2 (3221b91)
├── strong-deploy@2.2.2 (13baab4)
├── strong-pm@4.3.1 (45d254a)
├── strong-registry@1.1.5 (f46e58f)
├── strong-start@1.2.0 (e59f8b5)
├─┬ strong-supervisor@2.0.2 (610a578)
│ └── strong-agent@1.6.2
├── generator-loopback@1.10.1 (eae270c)
├── node-inspector@0.7.4
└── nodefly-register@0.3.3
When I use node /usr/local/bin/slc run server.js
, it instead gives me error on the lines of the generator function:
/Users/xxx/.app/server.js:8
co(function*() {
^
SyntaxError: Unexpected token *
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Object.<anonymous> (/usr/local/lib/node_modules/strongloop/node_modules/strong-supervisor/bin/sl-run.js:76:19)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
Which is expected.
I am wondering if this is an account related issue? I am using a trial account locally (OS X), but I have ran slc strongops
and setup the credentials.
I suppose worst case I can just use babel to compile it back.
@evanhuang8 Based on the error, I don't think it's an account issue. It looks like something about the app's use of ES6 is breaking a this
binding inside the agent somehow. Is the app source public or are you able to reduce it to a small example that fails?
Unfortunately the source code is private, but per your note I did some trace and it seems like it's sequelize package that is causing problems, which I don't think actually has to do with the harmony stuff?
Did a bit more debugging, so in the function
Agent.prototype.strongTraceLink = function(dbId, query, args){
var linkName = dbId + ' ' + query;
var callbackIndex = -1;
for(callbackIndex = args.length - 1; callbackIndex >= 0; callbackIndex--){
if (typeof args[callbackIndex] === 'function') {
args[callbackIndex] = this.transactionLink(linkName, args[callbackIndex]);
break;
}
}
if (callbackIndex === -1) {
console.log(this);
console.log(args);
args.push(this.transactionLink(linkName, function(){}));
}
}
The args is actually like this:
{ '0': 'SET time_zone = \'+00:00\'' }
instead of an array, which is then causing the undefined is not a function problem
It seems like whenever I am trying to sync the table via sequelize, it gives me the error; if I simply establish a db connection, no errors will occur. Would this be an issue for the mysql tracing in the strong agent?
@evanhuang8 thanks for the effort. I think I found the root of the problem and we're working on a fix.
@rmg awesome thanks!
Should be fixed in strong-agent@1.6.3, @evanhuang8, can you try? Thanks for the trouble-shooting.
My comments about --harmony
stand! Consider using io.js, or 6to5.
@sam-github it works now, thanks for the good work!
As for --harmony
, all I really need is generators (and yield), would io.js be a good fit out of the box (for production)? I could use 6to5 for my codebase, but how would I deal with external dependencies (like koa.js, which still runs on generators)
For using generators, in order of "production readiness", I would say:
node --harmony
I am trying to run my application locally via
slc run
, but since the app uses ES6 features, I have to run it in harmony mode, so I did:node --harmony /usr/local/bin/slc run server.js
However, the following error pops up:
What's wrong here?