<ul dir="auto">
<li>[ x] I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>


<p dir="auto">I should be able to run a nextjs app on multiple server replicas without errors occurring.</p>
<h2 dir="auto">Current Behavior</h2>


<p dir="auto">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 <code class="notranslate">500 - Internal Server Error. undefined</code>. There is no server log with more error details.</p>
<p dir="auto">This does not appear to be happening with a 3.x app run in a similar context.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>


<ol dir="auto">
<li>Create next.js 4 app</li>
<li>Run in kubernetes cluster</li>
<li>Load page repeatedly</li>
</ol>
<h2 dir="auto">Context</h2>


<p dir="auto">I've already implemented the build-stats hack here <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="260043254" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/2978" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/2978/hovercard?comment_id=334849384&amp;comment_type=issue_comment" href="https://github.com/vercel/next.js/issues/2978#issuecomment-334849384">#2978 (comment)</a> to have consistent build ids across the replicas. That resolved  that set of errors but now stuck with undebuggable errors.</p>
<p dir="auto">ETA: This appears to still be build id related. The error that's thrown has <code class="notranslate">buildIdMismatched: true</code> even through both replicas have identical <code class="notranslate">.next/build-stats.json</code> files.</p>
<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>4.1.4</td>
</tr>
<tr>
<td>node</td>
<td>8</td>
</tr>
<tr>
<td>OS</td>
<td>CoreOS</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome/Firefox</td>
</tr>
<tr>
<td>etc</td>
<td></td>
</tr>
</tbody>
</table>
<ul dir="auto">
<li>[x ] I have searched the <a href="https://github.com/zeit/next.js/issues?q=is%3Aissue">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">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.</p>
<h2 dir="auto">Current Behavior</h2>


<p dir="auto">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:<br>
<code class="notranslate">Error: Unknown system error -116: Unknown system error -116, stat '/usr/src/app/pages/overview.js'</code></p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<p dir="auto">The index page is very simple:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 = () =&gt; {
		const {doLogin} = this.props.userActions;
		doLogin();
	};
	render() {
		const {isRequestingLoginStatus} = this.props.user;

		return (
			&lt;div&gt;
				&lt;Button className=&quot;loginBtn&quot; onClick={this.onLoginClick} type=&quot;primary&quot;
					loading={isRequestingLoginStatus}&gt;Login&lt;/Button&gt;
				&lt;style jsx&gt;{`
			  .loginBtn {

			  }
			`}&lt;/style&gt;
			&lt;/div&gt;
		);
	}
}

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

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

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

export default withRedux(initStore, mapStateToProps, mapDispatchToProps)(Index);"><pre class="notranslate"><code class="notranslate">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 = () =&gt; {
		const {doLogin} = this.props.userActions;
		doLogin();
	};
	render() {
		const {isRequestingLoginStatus} = this.props.user;

		return (
			&lt;div&gt;
				&lt;Button className="loginBtn" onClick={this.onLoginClick} type="primary"
					loading={isRequestingLoginStatus}&gt;Login&lt;/Button&gt;
				&lt;style jsx&gt;{`
			  .loginBtn {

			  }
			`}&lt;/style&gt;
			&lt;/div&gt;
		);
	}
}

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

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

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

export default withRedux(initStore, mapStateToProps, mapDispatchToProps)(Index);
</code></pre></div>
<p dir="auto">I installed Sentry and it showed the following additional error information, the "touch" package is used by Next.js:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error: Unknown system error -116: Unknown system error -116, open '/usr/src/app/pages/index.js'
  File &quot;fs.js&quot;, line 667, in Object.fs.openSync
  File &quot;/usr/src/app/node_modules/touch/index.js&quot;, line 176, in TouchSync.open
    this.onopen(null, fs.openSync(this.path, this.oflags))
  File &quot;/usr/src/app/node_modules/touch/index.js&quot;, line 82, in new Touch
    this.open()
  File &quot;/usr/src/app/node_modules/touch/index.js&quot;, line 173, in new TouchSync
    class TouchSync extends Touch {
  File &quot;/usr/src/app/node_modules/touch/index.js&quot;, line 20, in Function.module.exports.sync.module.exports.touchSync
    (new TouchSync(validOpts(options, f, null)), undefined)
...
(4 additional frame(s) were not displayed)"><pre class="notranslate"><code class="notranslate">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)
</code></pre></div>
<p dir="auto">Screenshot of the Error, including Dev Tools:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2619527/37390861-b1a882bc-2769-11e8-8fe3-bc92bb1cdd23.png"><img src="https://user-images.githubusercontent.com/2619527/37390861-b1a882bc-2769-11e8-8fe3-bc92bb1cdd23.png" alt="next-error" style="max-width: 100%;"></a><br>
My Dockerfile for Next.js:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FROM node:latest
MAINTAINER Andreas Teufel &lt;a.teufel@limesoda.com&gt;
WORKDIR /usr/src/app
COPY package*.json ./
COPY yarn.lock ./
RUN yarn install
COPY . .
RUN yarn global add pm2
EXPOSE 3000
CMD [&quot;pm2-runtime&quot;, &quot;./docker/node/process.yml&quot;]"><pre class="notranslate"><code class="notranslate">FROM node:latest
MAINTAINER Andreas Teufel &lt;a.teufel@limesoda.com&gt;
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"]
</code></pre></div>
<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>5.0.0</td>
</tr>
<tr>
<td>node</td>
<td>8.x</td>
</tr>
<tr>
<td>OS</td>
<td>Ubuntu 17.10 on Digital Ocean</td>
</tr>
<tr>
<td>browser</td>
<td>latest Firefox/Chrome</td>
</tr>
<tr>
<td>docker</td>
<td>17.12.0-ce-win47</td>
</tr>
</tbody>
</table>