Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Errors building node 0.6.x with vulcan #7

Closed
jshepard opened this Issue Jan 12, 2012 · 16 comments

Comments

Projects
None yet
3 participants

I ran into trouble trying to create a custom nodejs build pack, as i dug in it seems the problem is actually building node with vulcan.

Here is the minimum repro case:

# install vulcan 0.1.5
gem install vulcan 

# create vulcan server
vulcan create my-vulcan-server

# download and extract node
curl http://nodejs.org/dist/node-v0.6.4.tar.gz -o node.tgz
tar xzvf node.tgz

# build with vulcan
cd node-v0.6.4
build -v -o ~/vulcan_output/node-0.6.4.tgz

Here is what i'm seeing:

Output file contains:

{"error":"not_found","reason":"Document is missing attachment"}

Digging in, it seems db.saveAttachment in web.js is failing with a 409 "Document update conflict." trying to save the input.
This is odd because when I check the doc in futon the input attachment is there and the version has been bumped to 2-xxxx

If I ignore the error from saveAttachment and press on, i see the same 409 conflict error when bin/make tries to attach the output, although in that case the output is not actually saved (possibly because when bin/make is getting the doc it's getting it back with the 1-xxx version?)

At first i thought this was a cloudant issue, but a simple test that does a cradle save + saveAttachement with a 10mb gz file worked against my vulcan servers cloudant instance (when running from my local machine).

Not sure where to go from here, but happy to keep investigating if you point me in the right direction.

mchung commented Jan 13, 2012

Ran into this error just a few hours ago as well with a different buildpack.

vulcan build -v -s nginx-1.0.11 -o nginx-heroku.tgz -c './configure --prefix=/app/vendor/nginx --without-http_rewrite_module --with-http_ssl_module && make install'

>> Packaging local directory
>> Uploading code for build
>> Building with: ./configure --prefix=/app/vendor/nginx --without-http_rewrite_module --with-http_ssl_module && make install
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
      <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
      <style type="text/css">
        html, body, iframe { margin: 0; padding: 0; height: 100%; }
        iframe { display: block; width: 100%; border: none; }
      </style>
    <title>Application Error</title></head>
    </head>
    <body>
      <iframe src="https://s3.amazonaws.com/heroku_pages/error.html">
        <p>Application Error</p>
      </iframe>
    </body>
    </html>!! Unknown error, no build output given

I created a simple test app and was able to repro the cloudant 409 conflict when using the node 0.4.7 as long as the file was larger than about 1mb. It still happens, but less frequently when the was using node 0.6.7 even with larger files (>10mb).

I tried creating a new vulcan server that used node 0.6.7 ( http://github.com/liquid/heroku-buildpack-nodejs.git ), and it got further. With this config, it's getting the following error when span_heroku tries to run bin/make :

`heroku run` requires the Heroku client version 2.4 or higher.
Please update your client with `heroku update` (Toolbelt install) or `gem install heroku` (Rubygems install).

bin/make seems to work just fine when when run through apps/:app/ps web form here:
https://api-docs.heroku.com/ps#POST/apps/ps

Contributor

ddollar commented Jan 14, 2012

I've got a vulcan server working in 0.6.7 but I'm back to getting the 409 conflict from CouchDB. I'm still diving in trying to find out why. The 'heroku run' error you're getting can be fixed (for now) by sending a User-Agent of 'heroku-gem/2.5' until we can get the API fixed to not throw that error for non heroku-gem User-Agents.

Contributor

ddollar commented Jan 14, 2012

This should be working now. Try vulcan 0.2.0 and remember to update your build server with vulcan update

I needed to change the requires for on and spawner to relative paths, but after i did that, it worked great.

Contributor

ddollar commented Jan 14, 2012

Ah, you'll need to set NODE_PATH to lib as a config var. I'll add that to the gem.

@ddollar ddollar closed this Jan 14, 2012

Contributor

ddollar commented Jan 14, 2012

Fixed in 0.2.3

hmmm. with the node_path fix i'm now getting (this is a newly created app)

012-01-14T16:46:30+00:00 heroku[web.1]: Starting process with command `node web.js`
2012-01-14T16:46:30+00:00 app[web.1]: 
2012-01-14T16:46:30+00:00 app[web.1]: node.js:134
2012-01-14T16:46:30+00:00 app[web.1]:         throw e; // process.nextTick error, or 'error' event on first tick
2012-01-14T16:46:30+00:00 app[web.1]:         ^
2012-01-14T16:46:30+00:00 app[web.1]: Error: Cannot find module 'zlib'
2012-01-14T16:46:30+00:00 app[web.1]:     at Function._resolveFilename (module.js:320:11)
2012-01-14T16:46:30+00:00 app[web.1]:     at Function._load (module.js:266:25)
2012-01-14T16:46:30+00:00 app[web.1]:     at require (module.js:348:19)
2012-01-14T16:46:30+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/restler/lib/restler.js:7:17)
2012-01-14T16:46:30+00:00 app[web.1]:     at Module.load (module.js:336:31)
2012-01-14T16:46:30+00:00 app[web.1]:     at Function._load (module.js:297:12)
2012-01-14T16:46:30+00:00 app[web.1]:     at require (module.js:348:19)
2012-01-14T16:46:30+00:00 app[web.1]:     at Module._compile (module.js:404:26)
2012-01-14T16:46:30+00:00 app[web.1]:     at Object..js (module.js:410:10)
2012-01-14T16:46:30+00:00 app[web.1]:     at Object.<anonymous> (/app/lib/spawner.js:5:15)
2012-01-14T16:46:31+00:00 heroku[web.1]: State changed from starting to crashed
Contributor

ddollar commented Jan 14, 2012

That means you need to be using Node.js 0.6, which should be happening due to the BUILDPACK_URL getting set to the #versions branch and package.json pointing to 0.6.x

Contributor

ddollar commented Jan 14, 2012

When you vulcan update can you paste the output here?

I see now. You need to update even if you recreate the vulcan server.
output from vulcan create

Creating jshepard-vulcan... done, stack is cedar
http://jshepard-vulcan.herokuapp.com/ | git@heroku.com:jshepard-vulcan.git
Initialized empty Git repository in /private/var/folders/8_/jq35p8jx0zb8xpk7hlzszn_h0000gn/T/d20120114-38037-7sh0ir/.git/
Counting objects: 176, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (156/156), done.
Writing objects: 100% (176/176), 327.34 KiB | 284 KiB/s, done.
Total 176 (delta 5), reused 0 (delta 0)

-----> Heroku receiving push
-----> Node.js app detected
-----> Fetching Node.js binaries
-----> Vendoring node 0.4.7
-----> Installing dependencies with npm 1.0.94
       node-uuid@1.3.3 ./node_modules/node-uuid 
       restler@0.2.4 ./node_modules/restler 
       knox@0.0.9 ./node_modules/knox 
       cradle@0.5.8 ./node_modules/cradle 
       └── vargs@0.1.0
       connect-form@0.2.1 ./node_modules/connect-form 
       └── formidable@1.0.8
       express@2.5.6 ./node_modules/express 
       ├── mkdirp@0.0.7
       ├── qs@0.4.0
       ├── mime@1.2.4
       └── connect@1.8.5
       connect-form@0.2.1 /tmp/build_jg35waxvp2gz/node_modules/connect-form
       formidable@1.0.8 /tmp/build_jg35waxvp2gz/node_modules/connect-form/node_modules/formidable
       cradle@0.5.8 /tmp/build_jg35waxvp2gz/node_modules/cradle
       vargs@0.1.0 /tmp/build_jg35waxvp2gz/node_modules/cradle/node_modules/vargs
       express@2.5.6 /tmp/build_jg35waxvp2gz/node_modules/express
       connect@1.8.5 /tmp/build_jg35waxvp2gz/node_modules/express/node_modules/connect
       qs@0.4.0 /tmp/build_jg35waxvp2gz/node_modules/express/node_modules/qs
       mime@1.2.4 /tmp/build_jg35waxvp2gz/node_modules/express/node_modules/mime
       formidable@1.0.8 /tmp/build_jg35waxvp2gz/node_modules/express/node_modules/connect/node_modules/formidable
       mkdirp@0.0.7 /tmp/build_jg35waxvp2gz/node_modules/express/node_modules/mkdirp
       knox@0.0.9 /tmp/build_jg35waxvp2gz/node_modules/knox
       node-uuid@1.3.3 /tmp/build_jg35waxvp2gz/node_modules/node-uuid
       restler@0.2.4 /tmp/build_jg35waxvp2gz/node_modules/restler
       Dependencies installed
-----> Discovering process types
       Procfile declares types -> web
-----> Compiled slug size is 7.6MB
-----> Launching... done, v4
       http://jshepard-vulcan.herokuapp.com deployed to Heroku

To git@heroku.com:jshepard-vulcan.git
 * [new branch]      master -> master

output from update

Initialized empty Git repository in /private/var/folders/8_/jq35p8jx0zb8xpk7hlzszn_h0000gn/T/d20120114-38089-539mlr/.git/
Counting objects: 176, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (156/156), done.
Writing objects: 100% (176/176), 327.34 KiB | 285 KiB/s, done.
Total 176 (delta 5), reused 0 (delta 0)

-----> Heroku receiving push
-----> Fetching custom buildpack... done
-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.6.7
       Using npm version: 1.0.106
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       restler@0.2.4 ./node_modules/restler 
       node-uuid@1.3.3 ./node_modules/node-uuid 
       knox@0.0.9 ./node_modules/knox 
       cradle@0.5.8 ./node_modules/cradle 
       └── vargs@0.1.0
       connect-form@0.2.1 ./node_modules/connect-form 
       └── formidable@1.0.8
       express@2.5.6 ./node_modules/express 
       ├── mime@1.2.4
       ├── qs@0.4.0
       ├── mkdirp@0.0.7
       └── connect@1.8.5
       connect-form@0.2.1 /tmp/build_25qytj9kmv7wh/node_modules/connect-form
       formidable@1.0.8 /tmp/build_25qytj9kmv7wh/node_modules/connect-form/node_modules/formidable
       cradle@0.5.8 /tmp/build_25qytj9kmv7wh/node_modules/cradle
       vargs@0.1.0 /tmp/build_25qytj9kmv7wh/node_modules/cradle/node_modules/vargs
       express@2.5.6 /tmp/build_25qytj9kmv7wh/node_modules/express
       connect@1.8.5 /tmp/build_25qytj9kmv7wh/node_modules/express/node_modules/connect
       qs@0.4.0 /tmp/build_25qytj9kmv7wh/node_modules/express/node_modules/qs
       mime@1.2.4 /tmp/build_25qytj9kmv7wh/node_modules/express/node_modules/mime
       formidable@1.0.8 /tmp/build_25qytj9kmv7wh/node_modules/express/node_modules/connect/node_modules/formidable
       mkdirp@0.0.7 /tmp/build_25qytj9kmv7wh/node_modules/express/node_modules/mkdirp
       knox@0.0.9 /tmp/build_25qytj9kmv7wh/node_modules/knox
       node-uuid@1.3.3 /tmp/build_25qytj9kmv7wh/node_modules/node-uuid
       restler@0.2.4 /tmp/build_25qytj9kmv7wh/node_modules/restler
       Dependencies installed
-----> Discovering process types
       Procfile declares types -> web
-----> Compiled slug size is 8.0MB
-----> Launching... done, v8
       http://jshepard-vulcan.herokuapp.com deployed to Heroku

To git@heroku.com:jshepard-vulcan.git
 + 5dce3dd...a98ea04 master -> master (forced update)
Contributor

ddollar commented Jan 14, 2012

Looks like BUILDPACK_URL was getting set too late. Fixed in 0.2.4

that didn't seem to work on first create (still getting 4.7)... any reason not to set the build pack when the app is actually created?

system "env BUNDLE_GEMFILE= heroku create #{name} -s cedar --buildpack https://github.com/heroku/heroku-buildpack-nodejs.git#versions"
Contributor

ddollar commented Jan 14, 2012

Well the idea is to have everything important actually happen in update and have create just set up the app and then call update

Contributor

ddollar commented Jan 14, 2012

Should be fixed in 0.2.5, including the conflicts in bin/make

works perfect first time through. Thanks David, i owe you a beer.

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