Paperspace / paperspace-node

Paperspace API for node.js
https://www.paperspace.com/core
ISC License
75 stars 15 forks source link

NODE_ENV mismatch #11

Open cvalenzuela opened 6 years ago

cvalenzuela commented 6 years ago

Hello there!

I'm developing an app with electron and I have my own custom environment variables. Running any request to the paperspace api with my own NODE_ENV creates an error in line 14 of client.js:

var nodeEnv = processEnv.NODE_ENV;
var config = configInfo[nodeEnv || 'production'];

Throwing this:

TypeError: Cannot read property 'host' of undefined

because I don't have a custom .host variable in my environment variable.

I got to pass the error by specifying production always:

var config = configInfo['production'];

I'm not sure if this is the intended behavior. If not, I can submit a PR to fix this

sanfilip commented 6 years ago

We left this in for local debugging during development, but didn't think about it conflicting with other developers. Sorry about that. A better fix might be to check for a list of explicit values, e.g. 'production', and default to 'production' if we don't recognize the NODE_ENV value.

What value are you setting NODE_ENV to?

cvalenzuela commented 6 years ago

I'm setting NODE_ENV to development because I have another process that uses that to minify and preprocess files.