Deploying Meteor 0.9.2.1 on Heroku - node.js

When I try to deploy my Meteor app to Heroku, it crashes on boot.
Exception from task: Error: function expects no more than -1 arguments
at /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:26:10
at readUtf8FileSync (packages/boilerplate-generator/boilerplate-generator.js:7)
at packages/boilerplate-generator/boilerplate-generator.js:82
at Array.forEach (native)
at Function._.each._.forEach (packages/underscore/underscore.js:105)
at Boilerplate._generateBoilerplateFromManifestAndSource (packages/boilerplate-generator/boilerplate-generator.js:64)
at new Boilerplate (packages/boilerplate-generator/boilerplate-generator.js:17)
at generateBoilerplateInstance (packages/webapp/webapp_server.js:288)
at packages/webapp/webapp_server.js:556
at Function._.each._.forEach (packages/underscore/underscore.js:113)
throw err;
^
Error: function expects no more than -1 arguments
at Object.Future.wait (/app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:326:15)
at _.extend.runTask (packages/meteor/fiber_helpers.js:79)
at Object.WebAppInternals.generateBoilerplate (packages/webapp/webapp_server.js:553)
at Object.main (packages/webapp/webapp_server.js:773)
at /app/.meteor/heroku_build/app/programs/server/boot.js:194:27
- - - - -
at /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:26:10
at readUtf8FileSync (packages/boilerplate-generator/boilerplate-generator.js:7)
at packages/boilerplate-generator/boilerplate-generator.js:82
at Array.forEach (native)
at Function._.each._.forEach (packages/underscore/underscore.js:105)
at Boilerplate._generateBoilerplateFromManifestAndSource (packages/boilerplate-generator/boilerplate-generator.js:64)
at new Boilerplate (packages/boilerplate-generator/boilerplate-generator.js:17)
at generateBoilerplateInstance (packages/webapp/webapp_server.js:288)
at packages/webapp/webapp_server.js:556
at Function._.each._.forEach (packages/underscore/underscore.js:113)
It seems that Npm.require('fs').readFile.length is undefined.
I'm using this buildpack. When I build the app locally and test with node main.js it works. Are there any other changes that I need to make to the buildpack for Meteor 0.9.2.1?

I figured out what the problem is, and it is not caused by the buildpack or Heroku.
I'm using Nodetime which wraps fs.readFile and then calls the original with apply. This is the reason why Npm.require('fs').readFile.length is 0 (not undefined like I had thought).

Related

when using create-react-app; I get Compiling RuleSet failed Error when running npm start. Query arguments on 'loader' has been removed

While setting up my dev environment for react, I've become unable to get a server to run. I've done fresh re-installs of npm, node, create-react-app, and I get thrown the same error everytime I run npm start.
/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/react-scripts/scripts/start.js:19
throw err;
^
Error: Compiling RuleSet failed: Query arguments on 'loader' has been removed in favor of the 'options' property (at ruleSet[1].rules[0].loader: /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/source-map-loader/dist/cjs.js)
at RuleSetCompiler.error (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:373:10)
at /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/UseEffectRulePlugin.js:160:29
at Hook.eval [as call] (eval at create (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:49:1)
at RuleSetCompiler.compileRule (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:177:19)
at /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:154:9
at Array.map (<anonymous>)
at RuleSetCompiler.compileRules (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:153:16)
at RuleSetCompiler.compileRule (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:184:30)
at /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:154:9
at Array.map (<anonymous>)
This is being done on a new machine that hasn't had any developer tools installed previously.
Not a Duplicate of Error: Compiling RuleSet failed: Query arguments on 'loader' has been removed in favor of the 'options' property
My error occurs in a different file that has a different structure.
7-react-tutorial/node_modules/source-map-loader/dist/cjs.js looks as such
"use strict";
const loader = require("./index");
module.exports = loader.default;
module.exports.raw = loader.raw;

Nanoexpress server fails on Heroku & AWS - runs fine locally - cannot trace 'dest.on()' error

Relevant stack-trace below - from Heroku:
2020-04-28T17:49:11.997756+00:00 app[web.1]: Your app is listening on port 14385
2020-04-28T17:49:12.491486+00:00 heroku[web.1]: State changed from starting to up
2020-04-28T17:49:41.748150+00:00 heroku[web.1]: State changed from up to crashed
2020-04-28T17:49:41.649885+00:00 app[web.1]: _stream_readable.js:660
2020-04-28T17:49:41.649896+00:00 app[web.1]: dest.on('unpipe', onunpipe);
2020-04-28T17:49:41.649897+00:00 app[web.1]: ^
2020-04-28T17:49:41.649897+00:00 app[web.1]:
2020-04-28T17:49:41.649898+00:00 app[web.1]: TypeError: dest.on is not a function
2020-04-28T17:49:41.649899+00:00 app[web.1]: at ReadStream.Readable.pipe (_stream_readable.js:660:8)
2020-04-28T17:49:41.649900+00:00 app[web.1]: at SendStream.stream (/app/node_modules/send/index.js:798:10)
2020-04-28T17:49:41.649900+00:00 app[web.1]: at SendStream.send (/app/node_modules/send/index.js:707:8)
2020-04-28T17:49:41.649900+00:00 app[web.1]: at /app/node_modules/send/index.js:774:12
2020-04-28T17:49:41.649901+00:00 app[web.1]: at FSReqCallback.oncomplete (fs.js:172:5)
From AWS (EC2 using a Bitnami instance for NodeJS apps):
Your app is listening on port 8080
_stream_readable.js:666
dest.on('unpipe', onunpipe);
^
TypeError: dest.on is not a function
at ReadStream.Readable.pipe (_stream_readable.js:666:8)
at SendStream.stream (/opt/bitnami/apps/demo/htdocs/node_modules/send/index.js:798:10)
at SendStream.send (/opt/bitnami/apps/demo/htdocs/node_modules/send/index.js:707:8)
at /opt/bitnami/apps/coronavirus-demo/htdocs/node_modules/send/index.js:774:12
at FSReqCallback.oncomplete (fs.js:167:5)
error: Forever detected script exited with code: 1
error: Script restart attempt #1
I see that we seem to be dying on _stream_readable.js:666 where 'dest.on' isn't defined - and I'm way into the weeds of Node at this point - so I'm not sure what I'm looking for, but I find that we're defining this method further down in the file:
https://github.com/nodejs/node/blob/master/lib/_stream_readable.js:852 -
Is this as simple as we're evaluating this _stream_readable file top-down and we haven't defined on() as of line 666 and that's why it's failing?
But why would it work locally? The app runs fine with Nanoexpress server on a Macbook Pro - same package.json and lock files - no devDependencies that make any difference (the only devDependencies are like Mocha and Sinon and Chai for tests)
I've run the app locally with NODE_ENV=production and NPM_CONFIG_PRODUCTION=true (it's a React & Express [Nanoexpress] app) and it boots and I can get what I need running just fine.
It's only when I push to Heroku / AWS that I'm getting this failure. Feels like we're trying to use a function before it's defined...
nanoexpress author here.
nanoexpress works fine on Heroku on my projects, but on AWS did not test, but nanoexpress does not support Lambda/Serverless.
Please check first your code or try PRO version as now it's Free

Getting error cannot read property 'stripe' of undefined (Meteor)

I an new to Meteor framework and trying to setup Meteor project in my local system and its showing below error. I tried googling but didnt find the solution.
/Users/progeshsubba/.meteor/packages/meteor-tool/.1.4.4_1.zu6xaw.bnn3++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
throw(ex);
^
TypeError: Cannot read property 'stripe' of undefined
at meteorInstall.server.methods.plans.methods.js (server/methods/plans/methods.js:3:32)
at fileEvaluate (packages/modules-runtime.js:197:9)
at require (packages/modules-runtime.js:120:16)
at /Users/progeshsubba/Desktop/surveyand/.meteor/local/build/programs/server/app/app.js:2672:1
at /Users/progeshsubba/Desktop/surveyand/.meteor/local/build/programs/server/boot.js:303:34
at Array.forEach (native)
at Function._.each._.forEach (/Users/progeshsubba/.meteor/packages/meteor-tool/.1.4.4_1.zu6xaw.bnn3++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /Users/progeshsubba/Desktop/surveyand/.meteor/local/build/programs/server/boot.js:128:5
at /Users/progeshsubba/Desktop/surveyand/.meteor/local/build/programs/server/boot.js:352:5
at Function.run (/Users/progeshsubba/Desktop/surveyand/.meteor/local/build/programs/server/profile.js:510:12)
at /Users/progeshsubba/Desktop/surveyand/.meteor/local/build/programs/server/boot.js:351:11

Can't start my meteor app on a centos7 DO server

I just git cloned from Telescope's git repository and run meteor, but it can't start the app successfully. How to deal with this ? I've googled but I can't get a easy to follow solution.
=> Started proxy.
=> Started MongoDB. nova:rss: updating npm dependencies -- rss... Unexpected
mongo exit code null. Restarting.
/root/.meteor/packages/coffeescript/.1.0.17.1qmihgc++os+web.browser+web.cordova/plugin.compileCoffeescript.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:116
throw error;
^ Error: spawn ENOMEM
at errnoException (child_process.js:1011:11)
at ChildProcess.spawn (child_process.js:958:11)
at Object.exports.spawn (child_process.js:746:9)
at spawnMongod (/tools/runners/run-mongo.js:45:24)
at launchOneMongoAndWaitForReadyForInitiate (/tools/runners/run-mongo.js:468:12)
at launchMongo (/tools/runners/run-mongo.js:682:7)
at MongoRunner._startOrRestart (/tools/runners/run-mongo.js:789:19)
at [object Object]. (/tools/runners/run-mongo.js:857:14)
at runWithEnvironment (/tools/utils/fiber-helpers.js:112:21)

node require bluebird failing

I am running a node.js app and for some reason the node app is failing when requiring the bluebird module require('bluebird').
node version: 0.10.40
bluebird version: 3.3.4
This is really strange and the only thing I have to go off of is the stack trace here:
TypeError: Cannot call method 'split' of undefined
at Object.setBounds (app/node_modules/bluebird/js/release/debuggability.js:614:48)
at module.exports (app/node_modules/bluebird/js/release/promise.js:762:11)
at Object.<anonymous> (app/node_modules/bluebird/js/release/bluebird.js:9:36)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
var firstStackLines = firstLineError.stack.split("\n");
Again, the app runs just fine. When I add this one line require('bluebird') it crashes and I get this stack trace. Any ideas on what this error is coming from?
[Edit]
at line node_modules/bluebird/js/release/debuggability.js:614:48
> console.log(firstLineError);
[Error]
> console.log(firstLineError.message);
> console.log(firstLineError.stack);
undefined
> console.log(firstLineError.toString());
Error: Error
> console.log(firstLineError instanceof Error);
True
It is an Error object that is essentially empty
temporary solution
When I change the line node_modules/bluebird/js/release/debuggability.js:614 to
var firstStackLines = (firstLineError.stack) ? firstLineError.stack.split("\n") : "";
and line 615 to
var lastStackLines = (lastLineError.stack) ? lastLineError.stack.split("\n") : "";
it works just fine. Not sure if this has lasting effects though
I had the similar failures, more specifically:
.../node_modules/bluebird/js/release/debuggability.js:673
var firstStackLines = firstLineError.stack.split("\n");
when using node 6.2.2 with bluebird^3.4.1.
Upgrading to bluebird^3.4.6 with node v6.2.2 helped fix the error.
Manually remove your node_modules folder and re-run npm install as it sounds like NPM didn't correctly install something.
You're using the latest version of Bluebird with an outdated version of node.
The problem for me was that I was using another module pretty-error that was modifying the console object and therefore, bluebirds error handling was receiving a mutated console object that was not the shape that bluebird expected.

Resources