laren0815 laren0815 - 28 days ago 18
Node.js Question

Error: write after end on Meteor app

I have today for the first time our new meteor app on modulus uploaded. When I tried to test them, the app crash with the error :

throw er; // Unhandled 'error' event

Error: write after end
at writeAfterEnd (_stream_writable.js:167:12)
at Socket.Writable.write (_stream_writable.js:212:5)
at Socket.write (net.js:626:40)
at [object Object].Connection.write (/mnt/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:502:58)
at /mnt/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:204:16
at executeScram (/mnt/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/auth/scram.js:176:5)
at /mnt/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/auth/scram.js:281:7
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)

The app tried three times to restart. The app ran normally for the fourth time. I could test everything and it worked. After about 10 minutes, the app crashed again with the same error message. From then on always randomly. What can I do?


My packages:

aaronroberson:ng-mask 3.0.16 AngularJS input masks packaged for meteor
accounts-base 1.2.14 A user account system
accounts-password 1.3.1 Password support for accounts
alanning:roles 1.2.15 Authorization package for Meteor
aldeed:simple-schema 1.5.3 A simple schema validation object with reactivity. Used by collection2 a...
alisalaah:jquery-contextmenu 1.6.6 JQuery ContextMenu by Rodney Rehm
altapp:recaptcha 2.0.1 Form bot protection for Meteor.
angular-meteor-auth 1.0.3* Angular-Meteor authentication module
angular-with-blaze 1.3.11 Everything you need to use both AngularJS and Blaze templates in your M...
angular:angular-animate 1.5.3_1 AngularJS (official) release. For full solution: http://angular-meteor...
angular:angular-material 1.0.6 Google Material design written for AngularJs (official repo)
angularui:angular-ui-router 0.2.15 angular-ui-router (official): Flexible routing with nested views in Ang...
bevanhunt:leaflet 2.0.1* leaflet - mobile-friendly maps.
check 1.2.4 Check whether a value matches a pattern
dandv:jquery-rateit 1.0.22_2 RateIt - a modern, mobile-friendly, jQuery (star) rating plugin
ecmascript 0.5.9 Compiler plugin that supports ES2015+ in all .js files
edgee:slingshot 0.7.1 Directly post files to cloud storage services, such as AWS-S3.
ejson 1.0.13 Extended and Extensible JSON library
email 1.1.18 Send email messages
erasaur:meteor-lodash 4.0.0 Wrapper for Lo-Dash v4.0.0
erasaur:server-session 0.0.5 Meteor Server-side Sessions, similar to the typical Client Session
es5-shim 4.6.15 Shims and polyfills to improve ECMAScript 5 support
fortawesome:fontawesome 4.6.3* Font Awesome (official): 500+ scalable vector icons, customizable via CS...
gfk:mediator 1.0.0 Adds a mediator to your application
gromo:jquery.scrollbar 0.0.1 Cross-browser CSS customizable scrollbar with advanced features.
harrison:papa-parse 1.1.1 A powerful, in-browser CSV parser for big boys and girls
http 1.2.10 Make HTTP calls to remote servers
jonblum:jquery-cropper 2.3.0 Fengyuan Chen's terrific jQuery plugin for cropping/zooming/rotating ima...
lucavandro:angular-moment-with-locales 0.10.3 Angular-Meteor directive and filters for Moment.JS with locales
matb33:collection-hooks 0.8.4 Extends Mongo.Collection with before/after hooks for insert/update/remov...
matthieuh:angular-local-storage 0.2.2 Angular module that gives you access to the browsers local storage with ...
maxkferg:temp 1.0.0 Create tracked temporary files on the server
mdg:validated-method 1.1.0 A simple wrapper for Meteor.methods
meteor-base 1.0.4 Packages that every Meteor app needs
meteorhacks:kadira 2.30.0* Performance Monitoring for Meteor
meteorhacks:meteor-down 1.1.2 Load Testing Framework for Meteor
meteorhacks:npm 1.5.0 Use npm modules with your Meteor App
meteorhacks:sikka 1.0.1 Sikka - A Firewall for Meteor Apps
mobile-experience 1.0.4 Packages for a great mobile user experience
mongo 1.1.14 Adaptor for using MongoDB and Minimongo over DDP
mrt:external-file-loader 0.1.4 The External File Loader package helps easily load external js, css and ...
nimble:restivus 0.8.11 Create authenticated REST APIs in Meteor 0.9+ via HTTP/HTTPS. Setup CRU...
npm-container 1.2.0+ Contains all your npm dependencies
pacozaa:angular-material-data-table 0.9.9 Material Design Data Table for Angular Material
pdiniz:canvas-to-blob 0.0.2 Simple wrapper around the blueimp's JavaScript-Canvas-to-Blob package
peerlibrary:aws-sdk 2.4.9_1 SDK for AWS services including Amazon S3, Amazon EC2, DynamoDB, and Am...
perak:joins 1.0.8 Generic collection joins for Meteor
percolate:synced-cron 1.3.2 Allows you to define and run scheduled jobs across multiple servers.
planettraining:angular-translate 2.10.0 Angular Translate
planettraining:angular-translate-loader-static-files 2.10.0 Angular Translate
practicalmeteor:chai 2.1.0_1 The Chai Assertion Library, v2.1.0
practicalmeteor:mocha 2.4.5_6 Write package tests with mocha and run them in the browser or from the...
random 1.0.10 Random number generator and utilities
reactive-var 1.0.11 Reactive variable
rzymek:moment-locale-de 2.14.1 Moment.js de locale. Companion package for rzymek:moment
sathriawan:angular-timer 1.3.5_3 Angular-Timer : A simple AngularJS directive demonstrating re-usabilit...
shell-server 0.2.1 Server-side component of the `meteor shell` command.
standard-minifier-css 1.3.2 Standard css minifier used with Meteor apps by default.
standard-minifier-js 1.2.1 Standard javascript minifiers used with Meteor apps by default.
tracker 1.1.1 Dependency tracker to allow reactive callbacks
undeadlol1:angular-filter-count-to 1.0.0 Angular directive to animate counting to a number (by sparkalow)
urigo:angular-blaze-template 0.3.0 Include Blaze templates in your angular-meteor application.
urigo:angular-ui-router 0.7.0 urigo:angular-ui-router, adds the ability to use Blaze templates with ui...
veekungx:sc-date-time 1.1.6 A Date-Time picker based on Googles Material Design Spec http://simeonc....


After 10 days I finally found the solution. After I deleted certain packages and reinstalled them, I checked the environment variables. Here was the environment variable:

MONGO_URL: mongodb://<username>:<password>@shard1:15689,shard2:15689/myDB

This I changed to

MONGO_URL: mongodb://<username>:<password>@shard1:15689/myDB.

That solved the problem.