<h1 dir="auto">Examples bug report</h1>
<h2 dir="auto">Example name</h2>
<p dir="auto">auth0</p>
<h2 dir="auto">Describe the bug</h2>
<p dir="auto">builds with errors</p>
<h2 dir="auto">To Reproduce</h2>
<ol dir="auto">
<li><code class="notranslate">npx create-next-app --example auth0 auth0</code></li>
<li>Change target to serverless</li>
<li><code class="notranslate">yarn build</code></li>
<li>See error</li>
</ol>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">Should build with no errors</p>
<h2 dir="auto">Screenshots</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Creating an optimized production build  

Compiled with warnings.

/Users/alisowski/Documents/kikbak-2/node_modules/got/source/request-as-event-emitter.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/require.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/require.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/encoding/lib/iconv-loader.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/keyv/src/index.js
Critical dependency: the request of a dependency is an expression

&gt; Build error occurred
{ Error: The cookieSecret setting is empty or null
    at new CookieSessionStoreSettings (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:22328:19)
    at Object.createInstance [as default] (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:7667:29)
    at initAuth0 (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:21557:47)
    at Object.2NqA (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:2846:127)
    at __webpack_require__ (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:23:31)
    at Module.qWSV (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:36832:13)
    at __webpack_require__ (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:23:31)
    at module.exports.+3SS.strict (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:91:18)
    at Object.&lt;anonymous&gt; (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:94:10)"><pre class="notranslate"><code class="notranslate">Creating an optimized production build  

Compiled with warnings.

/Users/alisowski/Documents/kikbak-2/node_modules/got/source/request-as-event-emitter.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/require.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/next/dist/next-server/server/require.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/encoding/lib/iconv-loader.js
Critical dependency: the request of a dependency is an expression

/Users/alisowski/Documents/kikbak-2/node_modules/keyv/src/index.js
Critical dependency: the request of a dependency is an expression

&gt; Build error occurred
{ Error: The cookieSecret setting is empty or null
    at new CookieSessionStoreSettings (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:22328:19)
    at Object.createInstance [as default] (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:7667:29)
    at initAuth0 (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:21557:47)
    at Object.2NqA (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:2846:127)
    at __webpack_require__ (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:23:31)
    at Module.qWSV (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:36832:13)
    at __webpack_require__ (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:23:31)
    at module.exports.+3SS.strict (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:91:18)
    at Object.&lt;anonymous&gt; (/Users/alisowski/Documents/kikbak-2/packages/test/.next/serverless/pages/advanced/ssr-profile.js:94:10)
</code></pre></div>
<h2 dir="auto">System information</h2>
<ul dir="auto">
<li>OS: macOS</li>
<li>Version of Next.js: 9.1.6</li>
</ul>
<h1 dir="auto">Bug report</h1>
<h2 dir="auto">Describe the bug</h2>
<p dir="auto">When deployed I get a TypeError: require is not a function error when importing npm module in api/allMovies.js. It works locally but not when deployed.</p>
<h2 dir="auto">To Reproduce</h2>
<ol dir="auto">
<li>clone <a href="https://github.com/tenjojeremy/test-nextjs-simple">https://github.com/tenjojeremy/test-nextjs-simple</a></li>
<li>run <code class="notranslate">yarn</code></li>
<li>run <code class="notranslate">yarn start</code></li>
<li>open localhost: 3000</li>
<li>You should see movie posters as expected</li>
<li>Deploy site</li>
<li>open deployed site url</li>
<li>you will see <code class="notranslate">Internal Server Error</code></li>
<li>logs will show error log:</li>
</ol>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/25231946/61072222-b4e16300-a3c7-11e9-8a7b-9a4694ff680a.png"><img src="https://user-images.githubusercontent.com/25231946/61072222-b4e16300-a3c7-11e9-8a7b-9a4694ff680a.png" alt="Screen Shot 2019-07-11 at 10 31 52 AM" style="max-width: 100%;"></a></p>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">On prod site, movies should be fetched and appear on screen on initial load</p>
<h2 dir="auto">Additional context</h2>
<p dir="auto">Related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="465964703" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/7850" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/7850/hovercard" href="https://github.com/vercel/next.js/issues/7850">#7850</a></p>
<p dir="auto">Thank you</p>