Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for NODE_ENV !== 'development' and not NODE_ENV === 'production' #116

Closed
TimFletcher opened this issue Jun 16, 2016 · 7 comments
Closed
Labels
Milestone

Comments

@TimFletcher
Copy link

Description of Problem

Deployment to Galaxy fails. No problems in dev mode, or if building locally / running production bundle locally.

Galaxy logs an uncaught exception with no useful information (and continually kills/loads containers) but I'm getting the following logged to Sentry which seems relevant. Should this code be going to production?

TypeError
Cannot read property 'absolutePath' of undefined
packages/gadicc_modules-runtime-hot/hot/proxy.js in WebApp.rawConnectHandlers.use.res.writeHead.content-type at line 15

screen shot 2016-06-16 at 9 16 16 am

## Environment - Meteor version: 1.3.3 - ecmascript-hot version: gadicc:ecmascript-hot@2.0.0-beta.5 - Operating System: OS X 10.10.5 / Galaxy ## Supporting files

.meteor/packages

# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

# --- MDG Packages ---

accounts-password
check
ejson
email
es5-shim
fastclick
force-ssl
http
jquery
meteor-base
mobile-experience
mongo
random
reactive-var
session
standard-minifier-css
standard-minifier-js
tracker

# --- Internal Packages ---

touchmail:core
touchmail:sentry

# --- Testing Packages ---

tmeasday:acceptance-test-driver
xolvio:backdoor
xolvio:cleaner

# --- Third Party Packages ---

alanning:roles
aldeed:collection2
cfs:filesystem
cfs:s3
cfs:standard-packages
fourseven:scss
kadira:dochead
kadira:flow-router
matb33:collection-hooks
mdg:validated-method
meteorhacks:picker
oaf:html5-desktop-notifications
vsivsi:job-collection
wylio:mandrill
zimme:active-route
meteorhacks:inject-initial
gadicc:ecmascript-hot@2.0.0-beta.5

.meteor/versions

accounts-base@1.2.7
accounts-password@1.1.10
alanning:roles@1.2.15
aldeed:collection2@2.9.1
aldeed:collection2-core@1.1.1
aldeed:schema-deny@1.0.1
aldeed:schema-index@1.0.1
aldeed:simple-schema@1.5.3
allow-deny@1.0.5
autoupdate@1.2.10
babel-compiler@6.8.0
babel-runtime@0.1.9
base64@1.0.9
binary-heap@1.0.9
blaze@2.1.8
blaze-tools@1.0.9
boilerplate-generator@1.0.9
caching-compiler@1.0.5
callback-hook@1.0.9
cfs:access-point@0.1.49
cfs:base-package@0.0.30
cfs:collection@0.5.5
cfs:collection-filters@0.2.4
cfs:data-man@0.0.6
cfs:file@0.1.17
cfs:filesystem@0.1.2
cfs:http-methods@0.0.32
cfs:http-publish@0.0.13
cfs:power-queue@0.9.11
cfs:reactive-list@0.0.9
cfs:reactive-property@0.0.4
cfs:s3@0.1.3
cfs:standard-packages@0.5.9
cfs:storage-adapter@0.2.3
cfs:tempstore@0.1.5
cfs:upload-http@0.0.20
cfs:worker@0.1.4
check@1.2.2
coffeescript@1.1.0
ddp@1.2.5
ddp-client@1.2.8
ddp-common@1.2.6
ddp-rate-limiter@1.0.5
ddp-server@1.2.7
deps@1.0.12
diff-sequence@1.0.6
ecmascript@0.4.4
ecmascript-runtime@0.2.11
ejson@1.0.12
email@1.0.13
es5-shim@4.5.11
fastclick@1.0.12
force-ssl@1.0.12
fourseven:scss@3.4.3
gadicc:ecmascript-hot@2.0.0-beta.5
gadicc:hot@2.0.0-beta.2
gadicc:hot-build@2.0.0-beta.5
gadicc:modules-runtime-hot@0.6.4-beta.0
gadicc:package-json@1.0.4
geojson-utils@1.0.9
hot-code-push@1.0.4
html-tools@1.0.10
htmljs@1.0.10
http@1.1.6
id-map@1.0.8
jquery@1.11.9
kadira:dochead@1.5.0
kadira:flow-router@2.12.1
launch-screen@1.0.12
livedata@1.0.18
localstorage@1.0.11
logging@1.0.13
matb33:collection-hooks@0.8.1
mdg:validated-method@1.1.0
mdg:validation-error@0.2.0
meteor@1.1.15
meteor-base@1.0.4
meteorhacks:inject-initial@1.0.4
meteorhacks:picker@1.0.3
minifier-css@1.1.12
minifier-js@1.1.12
minimongo@1.0.17
mobile-experience@1.0.4
mobile-status-bar@1.0.12
modules@0.6.2
modules-runtime@0.6.4
mongo@1.1.8
mongo-id@1.0.5
mongo-livedata@1.0.12
mrt:later@1.6.1
npm-bcrypt@0.8.6_1
npm-mongo@1.4.44
oaf:html5-desktop-notifications@1.0.0
observe-sequence@1.0.12
ordered-dict@1.0.8
package-version-parser@3.0.9
promise@0.7.2
raix:eventemitter@0.1.3
random@1.0.9
rate-limit@1.0.5
reactive-dict@1.1.8
reactive-var@1.0.10
reload@1.1.9
retry@1.0.8
routepolicy@1.0.11
sanjo:meteor-files-helpers@1.2.0_1
sanjo:meteor-version@1.0.0
service-configuration@1.0.10
session@1.1.6
sha@1.0.8
spacebars@1.0.12
spacebars-compiler@1.0.12
srp@1.0.9
standard-minifier-css@1.0.7
standard-minifier-js@1.0.7
tmeasday:acceptance-test-driver@0.1.0
touchmail:core@0.0.0
touchmail:sentry@0.0.1
tracker@1.0.14
ui@1.0.11
underscore@1.0.9
url@1.0.10
vsivsi:job-collection@1.4.0
webapp@1.2.9
webapp-hashing@1.0.9
wylio:mandrill@1.0.1
xolvio:backdoor@0.2.0
xolvio:cleaner@0.3.1
zimme:active-route@2.3.2

packages.json

{
  "devDependencies": {
    "autobind-decorator": "^1.3.3",
    "babel-core": "6.x.x",
    "babel-eslint": "^6.0.4",
    "babel-plugin-react-require": "2.x.x",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-polyfill": "6.x.x",
    "babel-preset-es2015": "6.x.x",
    "babel-preset-react": "6.x.x",
    "babel-preset-stage-2": "6.x.x",
    "babel-root-slash-import": "1.x.x",
    "chai": "3.x.x",
    "chai-datetime": "^1.4.1",
    "enzyme": "^2.2.0",
    "eslint": "^2.12.0",
    "eslint-config-airbnb": "^6.2.0",
    "eslint-plugin-react": "^4.3.0",
    "flightplan": "^0.6.13",
    "jsdom": "^8.0.4",
    "loglevel": "^1.4.0",
    "mocha": "2.x.x",
    "mocha-circleci-reporter": "0.0.1",
    "proxyquire": "^1.7.4",
    "raw-loader": "^0.5.1",
    "redbox-react": "^1.2.6",
    "sinon": "1.17.x",
    "style-loader": "^0.13.1"
  },
  "dependencies": {
    "babel-runtime": "^6.3.19",
    "body-parser": "^1.14.1",
    "classnames": "^2.1.3",
    "csv-parse": "^1.0.4",
    "handlebars": "^4.0.2",
    "indexof": "0.0.1",
    "input-moment": "^0.1.0",
    "load-script": "^1.0.0",
    "mantra-core": "^1.2.0",
    "marked": "^0.3.5",
    "meteor-node-stubs": "^0.2.1",
    "moment": "^2.11.1",
    "moment-timezone": "^0.5.4",
    "nylas": "2.2.0",
    "rc-tooltip": "^3.3.1",
    "react": "0.14.x",
    "react-datetime": "^2.1.0",
    "react-dom": "0.14.x",
    "react-gravatar": "^2.3.0",
    "react-hot-loader": "^3.0.0-beta.2",
    "react-intercom": "^1.0.10",
    "react-modal-dialog": "^2.0.0",
    "react-mounter": "^1.0.0",
    "react-quill": "zenoamaro/react-quill",
    "react-redux": "^4.4.0",
    "react-simple-di": "1.x.x",
    "react-tabs": "^0.5.1",
    "redux": "^3.3.1",
    "redux-form": "^5.2.4",
    "ua-parser-js": "^0.7.3",
    "winston": "^2.2.0",
    "winston-loggly": "^1.3.1"
  }
}

.babelrc (if you modified it)

{
  "plugins": [
    "transform-decorators-legacy",
    "react-hot-loader/babel"
  ]
}

client/.babelrc (if you modified it)

PASTE HERE

server/.babelrc (if you created it)

PASTE HERE
@gadicc
Copy link
Owner

gadicc commented Jun 16, 2016

Hey, thanks for the detailed report.

Fortunately with official .babelrc support now, as I guess you realized, the short term fix would be to switch back to the core ecmascript.

No, at this stage, nothing should make it through to production. It gets a bit tricky to conditionally load packages though, so we just disable everything in the package when we're in production.

The top 2 lines of proxy.js looks like this:

if (process.env.NODE_ENV === 'production')
  return;

Is there any possibility at all that your NODE_ENV is not set to production?

@TimFletcher
Copy link
Author

Is there any possibility at all that your NODE_ENV is not set to production?

There definitely is. It's set to staging. I'll try setting it to production and let you know how I get on.

@gadicc
Copy link
Owner

gadicc commented Jun 16, 2016

Ah ok, got it! I guess it's probably better to check if NODE_ENV !== 'development', but wow, I have the original check in so many places. But yes, that would be the right way to do it :>

OT: curious what kind of special things you do when it's staging ?

@gadicc gadicc changed the title Galaxy Deployment with gadicc:ecmascript-hot@2.0.0-beta.5 Check for NODE_ENV !== 'development' and not NODE_ENV === 'production' Jun 16, 2016
@gadicc gadicc added the bug label Jun 16, 2016
@gadicc gadicc added this to the v2 milestone Jun 16, 2016
@gadicc gadicc closed this as completed in 67b6188 Jun 16, 2016
@gadicc
Copy link
Owner

gadicc commented Jun 16, 2016

Will be in the next beta :)

@TimFletcher
Copy link
Author

Awesome. Thanks for the fix!!

I'm using NODE_ENV='staging' for a few things:

  • Adding a 'staging' tag to data sent to Loggly
  • Setting a different log level from production
  • Creating different prefab data for onboarding

I've had issues with this before though, for example Galaxy didn't respect setting NODE_ENV and always had it as production. Maybe I'd be better off just adding an environment key to my settings.json.

@gadicc
Copy link
Owner

gadicc commented Jun 16, 2016

Makes sense! Thanks! NODE_ENV is definitely intended to be used how you describe, so I was happy to fix this my end. But as you saw, many people assume it's only one of two values, so you might be saving yourself some time in the future with the other approach you suggested. Or you could just wait for time #3 :)

@damonmaria
Copy link

This also help me out with a different use case. I run my acceptance tests with NODE_ENV=test and I'd prefer hot reloading to be off during these tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants