Jędrzej Kuryło
01/31/2022, 4:48 PMyarn build
works fine when run in the nextjs app's folder. When I try to build my stack though, I'm getting an error
Error: There was a problem building the "testapp" NextjsSite.
at NextjsSite.buildApp (/Users/jedrzej/Workspace/testapp/packages/sst/node_modules/@serverless-stack/resources/src/NextjsSite.ts:600:13)
at new NextjsSite (/Users/jedrzej/Workspace/testapp/packages/sst/node_modules/@serverless-stack/resources/src/NextjsSite.ts:148:16)
...
I can see output from the next.js being built, there are no errors in there, the output is the same output I see when I build the app manually. Is there a way to get more information about what went wrong? I tried adding some console.logs in /Users/jedrzej/Workspace/testapp/packages/sst/node_modules/@serverless-stack/resources/src/NextjsSite.ts
to see what the original error caught in there was, but for some reason it doesn't have any effect, as if it was cached by nodejs or sth...Frank
@serverless-stack/resources/dist/NextjsSite.ts
?Jędrzej Kuryło
01/31/2022, 5:08 PMJędrzej Kuryło
01/31/2022, 5:13 PMJędrzej Kuryło
01/31/2022, 5:15 PMJędrzej Kuryło
01/31/2022, 5:18 PMnext build
returns 0
, while
``````
returns 1
Frank
Jędrzej Kuryło
01/31/2022, 5:19 PMNext.js v12.0.7
Frank
v11.1.4
a try (latest v11)? Just to rule out it’s the version issue.Jędrzej Kuryło
01/31/2022, 5:22 PMJędrzej Kuryło
01/31/2022, 5:31 PMnext build
gives 0
, but node ...
gives 1. But the output of both commands is different, got some warnings in the latter, will fix them first and see if it helpedJędrzej Kuryło
01/31/2022, 5:35 PMinfo - Creating an optimized production build...
(node:18146) [DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE] DeprecationWarning: Chunk.hasEntryModule: Use new ChunkGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
warn - Compiled with warnings
./node_modules/next/dist/server/load-components.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/load-components.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/load-components.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/require.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/require.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/require.js
Critical dependency: the request of a dependency is an expression
those are extra lines I see in the output when I build with sst, it's not there when i do next build
Jędrzej Kuryło
01/31/2022, 5:58 PMnext build
and next start
to build and run the app? or does it use the build/start scripts in package.json
?Derek Kershner
01/31/2022, 8:13 PMwill it useandnext build
to build and run the app?next start
next build only
, in production there is no "run" persay, its a series of infrastructure and moving parts that should, more or less, mimic npm start
.Jędrzej Kuryło
02/01/2022, 9:29 AMconst webpack = require('webpack');
const dotenv = require('dotenv');
dotenv.config();
const apiKey = JSON.stringify(process.env.SHOPIFY_API_KEY);
/** @type {import('next').NextConfig} */
module.exports = {
webpack: config => {
const env = { API_KEY: apiKey };
config.plugins.push(new webpack.DefinePlugin(env));
return config;
},
reactStrictMode: true,
};
if I remove the webpack
property, it builds just fine with sst build
Frank
SHOPIFY_API_KEY
in?Jędrzej Kuryło
02/02/2022, 4:44 PM.env
file, and the file is just SHOPIFY_API_KEY=<my-key>
Jędrzej Kuryło
02/02/2022, 4:45 PMFrank