Apps created using 'derby new appname' dont work #170

Closed
VanCoding opened this Issue Nov 20, 2012 · 12 comments

Comments

Projects
None yet
5 participants

I've created a derby app using 'derby new test' and tried to run it but got an error after requesting...

Details here:
http://stackoverflow.com/questions/13475899/derby-app-created-using-derby-new-test-not-working

Hello,
I tried to repeat your steps and I got no error.
If I didn't undertood wrong the reported error stack, it seems you don't have write permission on the filesystem... may you check that?

Strange.. I'm logged on as root.
I deleted the app folder completely and recreated the app using the command mentioned above, but still the same thing.

Maybe reinstall derby?
How to remove it completely?

I'm running it on debian btw...

Update
I've now deleted every folder that had something to do with derby. I searched for them using find / -name derby
And cleared the complete npm cache and then reinstalled derby using npm install -g derby.

Still same thing...

Maybe I should try it with a virtual machine again...

Hmm, strange!
I'm running Ubuntu and I'm logged without root privileges. Did you tried withou root? Just in case ;)

Some thought:

  • Looking at the zlib code, it seems that the connection between client and server ended. Am I wrong?
  • Searching with uncle google, it may be related to Express. Which version do you have? For my derby apps I removed the strict requirement of version "3.0.0beta4", and I now use 3.0.3.
  • Any other thought?

I tried as another user that has the required permissions and had the same problem,

I've also set the version of gzippo to exactly 0.1.7 and that of express to 3.0.3 and executed "npm install" to apply it.
Still the same..

I then commented out 3 lines in lib/server/index.js:

 //.use(express.favicon())
 // Gzip static files and serve from memory
 //.use(gzippo.staticGzip(publicPath, {maxAge: ONE_YEAR}))
 // Gzip dynamically rendered content
 //.use(express.compress())

Now, I can see the demo page at the first page load, the loading does not finish tough and I still get the same error in the console. It's very strange.

Are derby apps completely self containing? Should I be able to copy the wohle folder to another machine that has installed node and run it?

If yes, I'll try it out on another machine. If it works, there's something wrong with my setup, if not, the app generation is different on my machine..

switz commented Nov 21, 2012

I believe this is a bug in Express. Try using express 3.0.0beta4.

On Tuesday, November 20, 2012 at 7:22 PM, Patrik Stutz wrote:

I tried as another user that has the required permissions and had the same problem,
I've also set the version of gzippo to exactly 0.1.7 and that of express to 3.0.3 and executed "npm install" to apply it.
Still the same..
I then commented out 3 lines in lib/server/index.js:
//.use(express.favicon()) // Gzip static files and serve from memory //.use(gzippo.staticGzip(publicPath, {maxAge: ONE_YEAR})) // Gzip dynamically rendered content //.use(express.compress())
Now, I can see the demo page at the first page load, the loading does not finish tough and I still get the same error in the console. It's very strange.
Are derby apps completely self containing? Should I be able to copy the wohle folder to another machine that has installed node and run it?
If yes, I'll try it out on another machine. If it works, there's something wrong with my setup, if not, the app generation is different on my machine..


Reply to this email directly or view it on GitHub (codeparty#170 (comment)).

Contributor

lefnire commented Nov 21, 2012

AFAIK, recent express & gzippo should be compatible: "gzippo":"*" and
"express":"*"

On Tue, Nov 20, 2012 at 7:55 PM, Daniel Saewitz notifications@github.comwrote:

I believe this is a bug in Express. Try using express 3.0.0beta4.

On Tuesday, November 20, 2012 at 7:22 PM, Patrik Stutz wrote:

I tried as another user that has the required permissions and had the
same problem,
I've also set the version of gzippo to exactly 0.1.7 and that of express
to 3.0.3 and executed "npm install" to apply it.
Still the same..
I then commented out 3 lines in lib/server/index.js:
//.use(express.favicon()) // Gzip static files and serve from memory
//.use(gzippo.staticGzip(publicPath, {maxAge: ONE_YEAR})) // Gzip
dynamically rendered content //.use(express.compress())
Now, I can see the demo page at the first page load, the loading does
not finish tough and I still get the same error in the console. It's very
strange.
Are derby apps completely self containing? Should I be able to copy the
wohle folder to another machine that has installed node and run it?
If yes, I'll try it out on another machine. If it works, there's
something wrong with my setup, if not, the app generation is different on
my machine..


Reply to this email directly or view it on GitHub (
codeparty#170 (comment)).


Reply to this email directly or view it on GitHubhttps://github.com/codeparty/derby/issues/170#issuecomment-10581439.

switz commented Nov 21, 2012

Basically, gzip is saying that something is trying to write after it's already been packaged up and sent over.

I found this thread kcbanner/connect-mongo#35 which states that your middleware might be in an incorrect order, but it appears that your middleware's order is in fact correct. Please uncomment them.

Try it on another machine and let us know what happens.

If that still doesn't work, you can try using Express' built in compression rather than gzippo.

.use(express.static(publicPath))

On Tuesday, November 20, 2012 at 7:22 PM, Patrik Stutz wrote:

I tried as another user that has the required permissions and had the same problem,
I've also set the version of gzippo to exactly 0.1.7 and that of express to 3.0.3 and executed "npm install" to apply it.
Still the same..
I then commented out 3 lines in lib/server/index.js:
//.use(express.favicon()) // Gzip static files and serve from memory //.use(gzippo.staticGzip(publicPath, {maxAge: ONE_YEAR})) // Gzip dynamically rendered content //.use(express.compress())
Now, I can see the demo page at the first page load, the loading does not finish tough and I still get the same error in the console. It's very strange.
Are derby apps completely self containing? Should I be able to copy the wohle folder to another machine that has installed node and run it?
If yes, I'll try it out on another machine. If it works, there's something wrong with my setup, if not, the app generation is different on my machine..


Reply to this email directly or view it on GitHub (codeparty#170 (comment)).

switz commented Nov 21, 2012

Hmm, I've done a bit more research. According to this stack overflow post, you should use compress before static. I'm using it the other way around (along with everyone else using Derby), but it's worth a shot.

http://stackoverflow.com/questions/6370478/express-gzip-static-content

You have to use() compress before static. compress replaces (https://github.com/senchalabs/connect/blob/2.3.9/lib/middleware/compress.js#L77-91)res.write and res.end so that it can proxy data through zlib. If static is before compress, it handles the entire request before the compress middleware has a chance to run and patch the resmethods. Steven, I've updated your answer to swap the use() calls.

I'm not sure if the same is true when using gzippo, but I would give it a try. It would explain why the res.write is closing.

On Tuesday, November 20, 2012 at 8:03 PM, Daniel Saewitz wrote:

Basically, gzip is saying that something is trying to write after it's already been packaged up and sent over.

I found this thread kcbanner/connect-mongo#35 which states that your middleware might be in an incorrect order, but it appears that your middleware's order is in fact correct. Please uncomment them.

Try it on another machine and let us know what happens.

If that still doesn't work, you can try using Express' built in compression rather than gzippo.

.use(express.static(publicPath))

On Tuesday, November 20, 2012 at 7:22 PM, Patrik Stutz wrote:

I tried as another user that has the required permissions and had the same problem,
I've also set the version of gzippo to exactly 0.1.7 and that of express to 3.0.3 and executed "npm install" to apply it.
Still the same..
I then commented out 3 lines in lib/server/index.js:
//.use(express.favicon()) // Gzip static files and serve from memory //.use(gzippo.staticGzip(publicPath, {maxAge: ONE_YEAR})) // Gzip dynamically rendered content //.use(express.compress())
Now, I can see the demo page at the first page load, the loading does not finish tough and I still get the same error in the console. It's very strange.
Are derby apps completely self containing? Should I be able to copy the wohle folder to another machine that has installed node and run it?
If yes, I'll try it out on another machine. If it works, there's something wrong with my setup, if not, the app generation is different on my machine..


Reply to this email directly or view it on GitHub (codeparty#170 (comment)).

I've swapped those two lines. No success. I'm currently trying on another machine, I'll let you know about the result :)
Thanks for your help!!

I still think the problem doesn't sit in express or gzippo. I think the first exception closes the connection which forces the second exception...

Update

When I just comment the following lines:

//.use(express.favicon())  
// Gzip dynamically rendered content
//.use(express.compress())
// Gzip static files and serve from memory
.use(express.static(publicPath))

I get this:

Error: Model mutation performed after bundling for clientId: 02de2cf2-e06e-47b7-a44b-e167bf0125b6
at Model.errorOnCommit [as _commit] (/derby/test/node_modules/derby/node_modules/racer/lib/bundle/bundle.Model.js:64:9)
at /derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:120:15
at next (/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at /derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:107:16
at next (/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at /derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:101:16
at next (/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at /derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:92:16
at next (/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at Object.run (/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:10:12)
ALREADY UNREGISTERED SERVER MODEL
Trace
at /derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:148:19
at Object.Promise.on (/derby/test/node_modules/derby/node_modules/racer/lib/util/Promise.js:29:7)
at EventEmitter.module.exports.events.bundle (/derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:138:26)
at EventEmitter.emit (events.js:123:20)
at Model.Klass.mixinEmit (/derby/test/node_modules/derby/node_modules/racer/lib/plugin.js:82:21)
at Model.mixin.server.bundle (/derby/test/node_modules/derby/node_modules/racer/lib/bundle/bundle.Model.js:36:12)
at Object.View._render (/derby/test/node_modules/derby/lib/View.server.js:352:9)
at /derby/test/node_modules/derby/lib/View.server.js:276:10
at Array.2 (/derby/test/node_modules/derby/lib/View.server.js:300:5)
at Object.Promise.resolve (/derby/test/node_modules/derby/node_modules/racer/lib/util/Promise.js:21:19)

/derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:150
    return store._startTxnBuffer(clientId);
                 ^
TypeError: Cannot call method '_startTxnBuffer' of undefined
at /derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:150:22
at Object.Promise.on (/derby/test/node_modules/derby/node_modules/racer/lib/util/Promise.js:29:7)
at EventEmitter.module.exports.events.bundle (/derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:138:26)
at EventEmitter.emit (events.js:123:20)
at Model.Klass.mixinEmit (/derby/test/node_modules/derby/node_modules/racer/lib/plugin.js:82:21)
at Model.mixin.server.bundle (/derby/test/node_modules/derby/node_modules/racer/lib/bundle/bundle.Model.js:36:12)
at Object.View._render (/derby/test/node_modules/derby/lib/View.server.js:352:9)
at /derby/test/node_modules/derby/lib/View.server.js:276:10
at Array.2 (/derby/test/node_modules/derby/lib/View.server.js:300:5)
at Object.Promise.resolve (/derby/test/node_modules/derby/node_modules/racer/lib/util/Promise.js:21:19)

Ok, there really seems to be a bug somewhere. I've tested it on Windows 7 and on a completely fresh Debian VM.
On windows 7 it worked without problems, on debian I got the exact same error.

It seems to be a problem that only occours on debian...

Don't know if it really is related to derby or if it's an unknown bug of one of your dependencies...

Today, it downloaded the newest version of derby using npm install -g derby and tried it again. And it worked!

So, I close the issue.

@VanCoding VanCoding closed this Jan 3, 2013

I have just done fresh new installation of node and derby in my machine (Windows 7).

Getting the same error as above!
Please guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment