Link to home
Create AccountLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

Why will this site not come up?

Here's what my console says:

b.gust@AHA-DT-BGUST2 MINGW64 /c/wamp64/www/bsmart (new-activity-stream)
$ npm start

> cams@1.0.0 start C:\wamp64\www\bsmart
> sh ./bin/start.sh

(node:6392) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
User and company already exist: {"_id":"5e2a0b8b374a731400c45b9b"}
You may log in with email accounts@appliedhealth.net and password C@tch0fTheDay!
Start making of the Form 5500 Collections.
Time to build a Saved Import.
Attempting to create all F_5500 collections.
(node:38084) UnhandledPromiseRejectionWarning: MongoWriteConcernError: No write concern mode named 'majority/dev-bsmart-bgust' found in replica set configuration
    at MessageStream.messageHandler (C:\wamp64\www\bsmart\node_modules\mongodb\lib\cmap\connection.js:256:20)
    at MessageStream.emit (events.js:210:5)
    at processIncomingData (C:\wamp64\www\bsmart\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
    at MessageStream._write (C:\wamp64\www\bsmart\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
    at doWrite (_stream_writable.js:431:12)
    at writeOrBuffer (_stream_writable.js:415:5)
    at MessageStream.Writable.write (_stream_writable.js:305:11)
    at TLSSocket.ondata (_stream_readable.js:727:22)
    at TLSSocket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23)
(node:38084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:38084) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My config file says that my URL should be localhost:4040

/* eslint-disable no-process-env */
const { Joi } = require('celebrate');

// require and configure dotenv, will load vars in .env in PROCESS.ENV
require('dotenv').config();

// define validation for all the env vars
const envVarsSchema = Joi.object({
  NODE_ENV: Joi.string()
    .valid('development', 'production', 'test', 'provision')
    .default('production'),
  PORT: Joi.number().default(4040),
  MONGODB_URI: Joi.string()
    .required()
    .description('Mongo DB host url'),
  MONGODB_PORT: Joi.number().default(27017),
  MONGODB_DATABASE: Joi.string()
    .required()
    .description('Mongo DB database'),
  MONGODB_READ_PREFERENCE: Joi.string()
    .required()
    .default('PRIMARY_PREFERRED'),
  SESSION_SECRET: Joi.string().required(),
  GOOGLE_MAP_KEY: Joi.string().required(),
  JWT_SECRET: Joi.string().required(),
  SMTP_HOST: Joi.string().required(),
  SMTP_PORT: Joi.number().required(),
  SMTP_POOL: Joi.string().required(),
  RESET_LINK: Joi.string().required(),
  SMTP_SENDER_ADDRESS: Joi.string().required(),
  DEV_AWS_ACCESS_KEY_ID: Joi.string().required(),
  DEV_AWS_SECRET_ACCESS_KEY: Joi.string().required(),
  AWS_ACCESS_KEY_ID: Joi.string().required(),
  AWS_SECRET_ACCESS_KEY: Joi.string().required(),
  USER_RETRIES: Joi.number().required(),
  USER_MIN_WAIT: Joi.number().required(),
  USER_MAX_WAIT: Joi.number().required(),
  GLOBAL_FREE_RETRIES: Joi.number().required(),
  GLOBAL_MIN_WAIT: Joi.number().required(),
  GLOBAL_MAX_WAIT: Joi.number().required(),
  GLOBAL_LIFETIME: Joi.number().required(),
  ATTACH_RESET_TO_REQUEST: Joi.string().required(),
  REFRESH_TIMEOUT_ON_REQUEST: Joi.string().required(),
  PASSWORD_MIN_LENGTH: Joi.number().required(),
  SMTP_LINK_EXPIRES_NUMBER: Joi.number().required(),
  SMTP_LINK_EXPIRES_PERIOD: Joi.string().required()
})
  .unknown()
  .required();

const { error, value: envVars } = envVarsSchema.validate(process.env);
if (error) {
  throw new Error(`Config validation error: ${error.message}`);
}

const config = {
  env: envVars.NODE_ENV,
  port: envVars.PORT,
  mongo: {
    uri: envVars.MONGODB_URI,
    port: envVars.MONGODB_PORT,
    database: envVars.MONGODB_DATABASE,
    readPreference: envVars.MONGODB_READ_PREFERENCE
  },
  sessionSecret: envVars.SESSION_SECRET,
  googleMapKey: envVars.GOOGLE_MAP_KEY,
  jwtSecret: envVars.JWT_SECRET,
  jwtExpiresIn: envVars.JWT_EXPIRES_IN,
  passwordMinLength: envVars.PASSWORD_MIN_LENGTH,
  smtp: {
    host: envVars.SMTP_HOST,
    port: envVars.SMTP_PORT,
    awsAccessKeyId: envVars.AWS_ACCESS_KEY_ID,
    awsSecretAccessKey: envVars.AWS_SECRET_ACCESS_KEY,
    devAwsAccessKeyId: envVars.DEV_AWS_ACCESS_KEY_ID,
    devAwsSecretAccessKey: envVars.DEV_AWS_SECRET_ACCESS_KEY,
    senderAddress: envVars.SMTP_SENDER_ADDRESS,
    resetLink: envVars.RESET_LINK,
    momentAddNumber: envVars.SMTP_LINK_EXPIRES_NUMBER,
    momentAddPeriod: envVars.SMTP_LINK_EXPIRES_PERIOD
  },
  userBruteForce: {
    freeRetries: envVars.USER_RETRIES,
    minWait: envVars.USER_MIN_WAIT,
    maxWait: envVars.USER_MAX_WAIT
  },
  globalBruteForce: {
    freeRetries: envVars.GLOBAL_FREE_RETRIES,
    minWait: envVars.GLOBAL_MIN_WAIT,
    maxWait: envVars.GLOBAL_MAX_WAIT,
    lifeTime: envVars.GLOBAL_LIFETIME,
    attachResetToRequest: envVars.ATTACH_RESET_TO_REQUEST
  }
};

module.exports = config;

Open in new window


So, I'm on my browser, I type in http://localhost:4040 and...

This site can’t be reachedlocalhost refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED


Is there anything that I'm missing?

Does the content from my console explain why my site won't even come up?  Am I on the wrong port?

Why can i not see the site?
Avatar of David Favor
David Favor
Flag of United States of America image

This might simply be a firewall issue.

Disable all your firewall rules, then redo your test.

If your test works, then you must open all ports you'll be using, for example port 4040.
Avatar of Bruce Gust

ASKER

I'm on a company computer and none of my coworkers are having this issue. So, I don't know if that's an option and even if it were, just because I seem to be flying solo on this error, is there anything else you can think of?

I did try a different port and that didn't help either...

Also, I'm working remotely. Not sure if that's a factor but I did want to mention that.
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Alright, well, I got this far:

C:\Users\b.gust>lxd: net14-fixdeliver # ifconfig | gren " inet "
'lxd:' is not recognized as an internal or external command,
operable program or batch file.

So, nuts!
Remove "lxd: net14-fixdeliver #" as this is the bash prompt on the machine where I ran the command.
Hey David!

I was able to do a screen share with my supervisor and he was able to walk me through it.

- Port 3000 (I had seen 4040 somewhere, but that was error #1)
- Instead of "yarn develop," we ran "docker-compose -f docker-compose.develop.yml up --build --abort-on-container-exit" which is what     "yarn develop" was triggering. It was through that approach that we got an error that revealed the real dealbreaker...
- Change back from a Windows Container to a Linux Container

And that got me up and running!

Thanks for your help!
You're welcome!