Logs are duplicated for some reason. Check out attached screenshot.I use one instance and standard environment.app.yamlruntime: nodejs10manual_scaling:instances: 1Also I use NextJs with custom server.package.json{"scripts": {"deploy": "gcloud app deploy","build": "next build ./src","start": "node -r dotenv/config server.js","analize": "ANALYZE=true yarn build","gcp-build": "yarn run build"},"dependencies": {"@google-cloud/debug-agent": "^4.2.2","@material-ui/core": "^4.1.1","@material-ui/icons": "^4.2.0","@material-ui/styles": "^4.5.0","@next/bundle-analyzer": "^8.1.0","@svgr/webpack": "^4.3.2","cassandra-driver": "^4.1.0","cassandra-store": "^5.0.0","clsx": "^1.0.4","crypto": "^1.0.1","crypto-js": "^3.1.9-1","dotenv": "^8.0.0","express": "^4.17.1","express-session": "^1.16.2","http-parser-js": "^0.5.2","isomorphic-unfetch": "^3.0.0","jsonwebtoken": "^8.5.1","ldapjs-client": "^0.1.1","material-table": "^1.52.0","mobx": "^5.15.4","mobx-react": "^6.1.8","mobx-state-tree": "^3.15.0","next": "^9.3.0","next-i18next": "^4.2.1","node-schedule": "^1.3.2","notistack": "^0.9.9","passport": "^0.4.1","passport-auth0": "^1.3.2","password-generator": "^2.2.0","path": "^0.12.7","php-serialize": "^3.0.0","prop-types": "^15.7.2","react": "^16.13.0","react-dom": "^16.13.0","react-i18next": "^11.3.3","rijndael-js": "^2.0.0","sass": "^1.26.2","uid-safe": "^2.1.5"},"devDependencies": {"@babel/plugin-proposal-class-properties": "^7.5.5","@babel/plugin-proposal-decorators": "^7.4.4","babel-eslint": "^10.0.2","eslint": "^5.16.0","eslint-config-airbnb": "^17.1.0","eslint-plugin-import": "^2.18.0","eslint-plugin-jsx-a11y": "^6.2.1","eslint-plugin-react": "^7.13.0"}}
server.js// Next line fixes this issue: https://stackoverflow.com/questions/36628420/nodejs-request-hpe-invalid-header-tokenprocess.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;const http = require('http');const express = require('express');const path = require('path');const next = require('next');const session = require('express-session');const bodyParser = require('body-parser');// Gcloudconst gcloudDebugAgent = require('@google-cloud/debug-agent');// Auth0const uid = require('uid-safe');const passport = require('passport');// i18nconst nextI18NextMiddleware = require('next-i18next/middleware').default;const nextI18next = require('./src/i18n');// Routesconst auth0Routes = require('./src/routes/auth0-routes');const mainRoutes = require('./src/routes/main-routes');const twoCheckoutRoutes = require('./src/routes/2checkout-routes');// Utils// const cassandraSessionStore = require('./src/utils/cassandraSessionStore.utils');const { initFortifiUtil } = require('./src/utils/fortifiApi.utils');const { initLdapClientUtil } = require('./src/utils/ldapClient.utils');const { initAuth0ManagememntUtil } = require('./src/utils/auth0ManagementApi.utils');const { auth0Strategy } = require('./src/utils/auth0Express.utils');console.log('process.env.NODE_ENV', process.env.NODE_ENV);const isProduction = process.env.NODE_ENV === 'production';if (isProduction) gcloudDebugAgent.start({ allowExpressions: true });Promise.all([initAuth0ManagememntUtil(),initLdapClientUtil(),initFortifiUtil(),]).then(responses => {responses.forEach(({ error }) => {if (error) {console.log('---> ---> Error: Init Utils', error);process.exit(1);}});});const app = next({dev: !isProduction,dir: './src',});const handle = app.getRequestHandler();const server = express();const serverInstance = http.createServer(server);app.prepare().then(async () => {// enable the use of request body parsing middlewareserver.use(bodyParser.json());server.use(bodyParser.urlencoded({extended: true}));// Need to use explicit define of static folder// because of [dir: './src',] in next initializationserver.use('/static', express.static(path.join(__dirname, './static')));// translationsawait nextI18next.initPromise;server.use(nextI18NextMiddleware(nextI18next));// Express session managementconst sessionConfig = {// disabled because of deploy problems on gcloud// store: cassandraSessionStore,secret: uid.sync(18),cookie: {// 24 hours in millisecondsmaxAge: 86400 * 1000,},resave: false,saveUninitialized: true,};server.use(session(sessionConfig));// Auth0 - Passport configuration`passport.use(auth0Strategy);passport.serializeUser((user, done) => done(null, user));passport.deserializeUser((user, done) => done(null, user));// Auth0 - adding Passport and authentication routesserver.use(passport.initialize());server.use(passport.session());// Routesserver.use(auth0Routes);server.use(mainRoutes);server.use(twoCheckoutRoutes);// handling everything else with Next.jsserver.get('*', handle);// app serverserverInstance.listen(process.env.PORT, (err) => {console.log(err || `Listening on port ${process.env.PORT}`);});});
--
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.digitalis.io