Issue 1:
[ x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I should be able to run a nextjs app on multiple server replicas without errors occurring.

Current Behavior

Trying to run next 4.1.4 in a kubernetes cluster and about half of the requests to the server result in "An unexpected error has occurred." If the request is made client-side, the only error in the console is 500 - Internal Server Error. undefined. There is no server log with more error details.

This does not appear to be happening with a 3.x app run in a similar context.

Steps to Reproduce (for bugs)

Create next.js 4 app

Run in kubernetes cluster

Load page repeatedly

Context

I've already implemented the build-stats hack here #2978 (comment) to have consistent build ids across the replicas. That resolved that set of errors but now stuck with undebuggable errors.

ETA: This appears to still be build id related. The error that's thrown has buildIdMismatched: true even through both replicas have identical .next/build-stats.json files.

Your Environment

Tech
Version

next
4.1.4

node
8

OS
CoreOS

browser
Chrome/Firefox

etc

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

Expected Behavior

I am using Docker on Digital Ocean for a Next.js based project, the main page is pretty simple and should just show nothing more than a Facebook login button.

Current Behavior

If i try to access it via Browser, the first time it works well and the Login button shows up - if i refresh the page, i get the following error on my screen:

Error: Unknown system error -116: Unknown system error -116, stat '/usr/src/app/pages/overview.js'

Steps to Reproduce (for bugs)

The index page is very simple:

import React from 'react';
import PropTypes from 'prop-types';
import {Button} from 'antd';
import {bindActionCreators} from 'redux';
import {initStore} from '../store';
import withRedux from 'next-redux-wrapper';
import * as userActionCreators from '../actions/user';

class Index extends React.Component {
constructor(props) {
super(props);
this.state = {

};
}
componentDidMount() {
const {checkLogin} = this.props.userActions;
//checkLogin(true); //disabled for now, but it makes no difference
}
onLoginClick = () => {
const {doLogin} = this.props.userActions;
doLogin();
};
render() {
const {isRequestingLoginStatus} = this.props.user;

return (
<div>
<Button className="loginBtn" onClick={this.onLoginClick} type="primary"
loading={isRequestingLoginStatus}>Login</Button>
<style jsx>{`
.loginBtn {

}
`}</style>
</div>
);
}
}

Index.propTypes = {
userActions: PropTypes.object,
user: PropTypes.object
};

const mapStateToProps = (state) => {
return {
user: state.user
};
};

function mapDispatchToProps(dispatch) {
return {
userActions: bindActionCreators(userActionCreators, dispatch)
};
}

export default withRedux(initStore, mapStateToProps, mapDispatchToProps)(Index);

I installed Sentry and it showed the following additional error information, the "touch" package is used by Next.js:

Error: Unknown system error -116: Unknown system error -116, open '/usr/src/app/pages/index.js'
File "fs.js", line 667, in Object.fs.openSync
File "/usr/src/app/node_modules/touch/index.js", line 176, in TouchSync.open
this.onopen(null, fs.openSync(this.path, this.oflags))
File "/usr/src/app/node_modules/touch/index.js", line 82, in new Touch
this.open()
File "/usr/src/app/node_modules/touch/index.js", line 173, in new TouchSync
class TouchSync extends Touch {
File "/usr/src/app/node_modules/touch/index.js", line 20, in Function.module.exports.sync.module.exports.touchSync
(new TouchSync(validOpts(options, f, null)), undefined)
...
(4 additional frame(s) were not displayed)

Screenshot of the Error, including Dev Tools:

My Dockerfile for Next.js:

FROM node:latest
MAINTAINER Andreas Teufel <a.teufel@limesoda.com>
WORKDIR /usr/src/app
COPY package*.json ./
COPY yarn.lock ./
RUN yarn install
COPY . .
RUN yarn global add pm2
EXPOSE 3000
CMD ["pm2-runtime", "./docker/node/process.yml"]

Your Environment

Tech
Version

next
5.0.0

node
8.x

OS
Ubuntu 17.10 on Digital Ocean

browser
latest Firefox/Chrome

docker
17.12.0-ce-win47