Issue 1:
The using-nerv example is not working

I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

can start the example server

Current Behavior

Getting error:

> using-nerv@1.0.0 start /Users/preuss/next.js/examples/using-nerv
> NODE_ENV=production node server.js

module.js:557
throw err;
^

Error: Cannot find module 'nervjs/server'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._resolveFilename (/Users/preuss/next.js/examples/using-nerv/node_modules/module-alias/index.js:43:29)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)

Steps to Reproduce (for bugs)

cd examples/using-nerv

npm i

npm run build && npm run start

Your Environment

Tech
Version

next
latest (5.0.0)

node
9.4.0

OS
osx

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I am proxyfying requests handled by my Express app to my Next.js app, which is used programatically.

I have express running on :3000 and next.js on :3001

I get TypeError: Cannot read property 'waitUntilReloaded' of undefined at HotReloader._callee7$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/hot-reloader.js:658:44) error message when loading any page.

const nextAppConfig = {
dev: !isHostedOnAWS() && process.env.NODE_ENV === 'development',
};
const nextApp = next(nextAppConfig);

const nextProxy = nextApp.getRequestHandler(); // Requests handled by nextProxy will be handled by the Next.js app

app.get('*', (req, res) => {
console.log('req from', req.protocol + '://' + req.get('host') + req.originalUrl);
nextProxy(req, res);
});

I don't reproduce this issue when running my app on AWS. See https://swn.dev.vadorequest.fr

sls TypeError: Cannot read property 'waitUntilReloaded' of undefined

sls at HotReloader._callee7$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/hot-reloader.js:658:44)

sls at tryCatch (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:62:40)

sls at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:296:22)

sls at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:114:21)

sls at step (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14

sls at Promise.F (/Users/vadorequest/dev/serverless-with-next/node_modules/core-js/library/modules/_export.js:35:28)

sls at HotReloader. (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)

sls at HotReloader.getCompilationErrors (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/hot-reloader.js:837:23)

sls at Server._callee25$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:1322:41)

sls at tryCatch (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:62:40)

sls at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:296:22)

sls at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:114:21)

sls at step (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14

sls at Promise.F (/Users/vadorequest/dev/serverless-with-next/node_modules/core-js/library/modules/_export.js:35:28)

sls at Server. (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)

sls at Server.getCompilationError (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:1346:23)

sls at Server._callee20$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:1040:29)

sls at tryCatch (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:62:40)

sls at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:296:22)

sls at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:114:21)

sls at step (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14

sls at Promise.F (/Users/vadorequest/dev/serverless-with-next/node_modules/core-js/library/modules/_export.js:35:28)

sls at Server. (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)

sls at Server.renderToHTML (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:1088:23)

sls at Server._callee19$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:992:29)

sls at tryCatch (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:62:40)

sls at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:296:22)

sls at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:114:21)

sls at step (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14

sls at Promise.F (/Users/vadorequest/dev/serverless-with-next/node_modules/core-js/library/modules/_export.js:35:28)

sls at Server. (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)

sls at Server.render (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:1020:23)

sls at Server._callee16$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:817:35)

sls at tryCatch (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:62:40)

sls at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:296:22)

sls at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:114:21)

sls at step (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14

sls at Promise.F (/Users/vadorequest/dev/serverless-with-next/node_modules/core-js/library/modules/_export.js:35:28)

sls at Object. (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)

sls at Object.fn (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:828:27)

sls at Router._callee$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/router.js:81:60)

sls at tryCatch (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:62:40)

sls at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:296:22)

sls at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:114:21)

sls at step (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14

sls at Promise.F (/Users/vadorequest/dev/serverless-with-next/node_modules/core-js/library/modules/_export.js:35:28)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12

sls at v (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/router.js:92:29)

sls at Server._callee18$ (/Users/vadorequest/dev/serverless-with-next/node_modules/next/dist/server/index.js:926:24)

sls at tryCatch (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:62:40)

sls at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:296:22)

sls at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/vadorequest/dev/serverless-with-next/node_modules/regenerator-runtime/runtime.js:114:21)

sls at step (/Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

sls at /Users/vadorequest/dev/serverless-with-next/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13

sls at process._tickDomainCallback (internal/process/next_tick.js:135:7)

Steps to Reproduce (for bugs)

I've made a specific branch to reproduce this issue at:

https://github.com/Vadorequest/serverless-with-next/tree/waitUntilReloaded

Context

I first made it work against AWS and then ran into trouble with a local setup. The main difference between both environment is the dev which is false on AWS.

On local env, I run Next.js as a standalone project to get HMR and automatic rebuilds to work.

Your Environment

Tech
Version

next
5.0.1-canary.9

node
6.10.3