Running Fluid Hello World Example Error Out - fluid-framework

I'm trying to run Fluid Hello World Example, after going through the steps and running the application the web browser error out with the following log message:
POST http://localhost:3000/documents/tinylicious 400 (Bad Request) with response body is 502.
Did I miss any step?
Update:
Running on Windows 10 1809 (1763.1397)
Console Output:
#fluid-example/hello-world#0.1.0 start C:\Users\****\Documents\Workspace\FluidHelloWorld
> concurrently "npm:start:server" "npm:start:client"
[start:server]
[start:server] > #fluid-example/hello-world#0.1.0 start:server C:\Users\****\Documents\Workspace\FluidHelloWorld
[start:server] > tinylicious
[start:server]
[start:client]
[start:client] > #fluid-example/hello-world#0.1.0 start:client C:\Users\****\Documents\Workspace\FluidHelloWorld
[start:client] > webpack-dev-server --open
[start:client]
[start:server] info: Listening on port 3000 {"label":"winston","timestamp":"2020-09-11T16:02:56.224Z"}
[start:client] i 「wds」: Project is running at http://localhost:8080/
[start:client] i 「wds」: webpack output is served from /
[start:client] i 「wds」: Content not from webpack is served from C:\Users\KISA01\Documents\Workspace\FluidHelloWorld
[start:client] i 「wdm」: wait until bundle finished: /
[start:client] i 「wdm」: Hash: 15f0e0aa78bd7f0ce32e
[start:client] Version: webpack 4.44.1
[start:client] Time: 11959ms
[start:client] Built at: 09/11/2020 12:03:10 PM
[start:client] Asset Size Chunks Chunk Names
[start:client] app.52afa0dcefa1c58ec9c3.js 7.84 MiB app [emitted] [immutable] app
[start:client] index.html 667 bytes [emitted]
[start:client] Entrypoint app = app.52afa0dcefa1c58ec9c3.js
[start:client] [0] multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.ts 40 bytes {app} [built]
[start:client] [./node_modules/#fluidframework/aqueduct/lib/index.js] 925 bytes {app} [built]
[start:client] [./node_modules/#fluidframework/get-tinylicious-container/lib/index.js] 180 bytes {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 4.29 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {app} [built]
[start:client] [./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js] (webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {app} [built]
[start:client] [./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {app} [built]
[start:client] [./src/app.ts] 3.3 KiB {app} [built]
[start:client] [./src/containerCode.ts] 1.03 KiB {app} [built]
[start:client] [./src/view.ts] 1.41 KiB {app} [built]
[start:client] + 658 hidden modules
[start:client] Child HtmlWebpackCompiler:
[start:client] 1 asset
[start:client] Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[start:client] [./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html] 913 bytes {HtmlWebpackPlugin_0} [built]
[start:client] i 「wdm」: Compiled successfully.
[start:server] info: OPTIONS /documents/tinylicious 204 3.718 ms - 0 {"label":"winston","timestamp":"2020-09-11T16:03:11.686Z"}
[start:server] info: POST /documents/tinylicious 400 180.004 ms - 3 {"label":"winston","timestamp":"2020-09-11T16:03:11.869Z"}

Related

Deployment Heroku, Build stopping after webpack bundles on heroku?

Not sure how to set up my environment to get my MERN application deployed on Heroku. I'm using EJS and webpack. When I deploy the application it is currently staying stuck at the webpack build phase:
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 12.18.3
engines.npm (package.json): unspecified (use default)
Resolving node version 12.18.3...
Downloading and installing node 12.18.3...
Using default npm version: 6.14.6
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
> fsevents#1.2.13 install /tmp/build_31a40992/node_modules/nodemon/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> nodemon#1.19.4 postinstall /tmp/build_31a40992/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
> bcrypt#5.0.1 install /tmp/build_31a40992/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
[bcrypt] Success: "/tmp/build_31a40992/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" is installed via remote
added 1003 packages in 7.872s
-----> Build
Running build
> project#1.0.0 build /tmp/build_31a40992
> webpack --mode production
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist#latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
asset App.js 592 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
orphan modules 10.6 KiB [orphan] 3 modules
runtime modules 663 bytes 3 modules
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 18.3 KiB
./src/App.jsx + 3 modules 17.2 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/PricesComponent.css 1.1 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
App.js (592 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (583 KiB)
BuyOrders.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33959 ms
asset Edit.js 580 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.13 KiB [orphan] 1 module
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 14.8 KiB
./src/AppDep/Edit.jsx + 1 modules 12.2 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Edit.css 2.64 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
Edit.js (580 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (580 KiB)
Edit.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33955 ms
asset MakeBuy.js 572 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.13 KiB [orphan] 1 module
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 9.07 KiB
./src/AppDep/MakeBuy.jsx + 1 modules 8.12 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Make.css 975 bytes [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
MakeBuy.js (572 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (572 KiB)
MakeBuy.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33960 ms
asset MakeSell.js 572 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.13 KiB [orphan] 1 module
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 9.48 KiB
./src/AppDep/MakeSell.jsx + 1 modules 8.53 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Make.css 975 bytes [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
MakeSell.js (572 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (572 KiB)
MakeSell.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 34225 ms
asset MyOrders.js 665 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
orphan modules 531 KiB [orphan] 266 modules
runtime modules 663 bytes 3 modules
cacheable modules 212 KiB
modules by path ./node_modules/ 142 KiB 15 modules
modules by path ./src/ 70.3 KiB
./src/AppDep/MyOrders.jsx + 12 modules 59.7 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/MyOrders.css 1.11 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Order.css 710 bytes [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Matches.css 1.17 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Edit.css 2.64 KiB [built] [code generated]
+ 2 modules
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
MyOrders.js (665 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (665 KiB)
MyOrders.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 37873 ms
asset Order.js 603 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
orphan modules 501 KiB [orphan] 259 modules
runtime modules 663 bytes 3 modules
cacheable modules 174 KiB
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
+ 1 module
modules by path ./src/ 32.8 KiB
./src/AppDep/Order.jsx + 5 modules 26.8 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Order.css 710 bytes [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Edit.css 2.64 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Form.css 2.71 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
Order.js (603 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (603 KiB)
Order.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 37116 ms
asset Prices.js 34.5 KiB [compared for emit] [minimized] (name: main) 1 related asset
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
./src/AppDep/Prices.jsx 3.99 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11248 ms
asset PricesComponent.js 69 KiB [compared for emit] [minimized] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 5.14 KiB [orphan] 2 modules
modules by path ./node_modules/ 17.4 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB
./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.28 KiB [built] [code generated]
./node_modules/css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 11.7 KiB
./src/AppDep/PricesComponent.jsx + 2 modules 10.6 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/PricesComponent.css 1.1 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11402 ms
asset SellOrders.js 583 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 6.42 KiB [orphan] 2 modules
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 20 KiB
./src/AppDep/SellOrders.jsx + 2 modules 17.4 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/SellOrders.css 2.6 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
SellOrders.js (583 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (583 KiB)
SellOrders.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33961 ms
asset Navigation.js 75.3 KiB [compared for emit] [minimized] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.15 KiB [orphan] 1 module
modules by path ./node_modules/ 17.4 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB
./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.28 KiB [built] [code generated]
./node_modules/css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 11 KiB
./src/AppDep/Navigation.jsx + 1 modules 6.73 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Navigation.css 4.27 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11400 ms
asset MatcheRow.js 69.4 KiB [compared for emit] [minimized] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.14 KiB [orphan] 1 module
modules by path ./node_modules/ 17.4 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB
./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.28 KiB [built] [code generated]
./node_modules/css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 8.09 KiB
./src/AppDep/MatcheRow.jsx + 1 modules 5.82 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/MatcheRow.css 2.27 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11399 ms
So ... webpack 5.67.0 compiled successfully in 11399 ms
but ... I ideally want to run
npm run server
after the build.
As a reference a successful MERN deployment on heroku should look like this:
-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.18.3...
Using default npm version: 6.14.15
-----> Installing dependencies
Installing node modules
added 538 packages in 5.08s
-----> Build
Running build
> deploy-react-webpack#1.0.0 build /tmp/build_8c86a15a
> webpack --mode production
asset main.js 129 KiB [emitted] [minimized] (name: main) 1 related asset
asset ./index.html 278 bytes [emitted]
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/react-dom/ 119 KiB
./node_modules/react-dom/index.js 1.33 KiB [built] [code generated]
./node_modules/react-dom/cjs/react-dom.production.min.js 118 KiB [built] [code generated]
modules by path ./node_modules/scheduler/ 4.91 KiB
./node_modules/scheduler/index.js 198 bytes [built] [code generated]
./node_modules/scheduler/cjs/scheduler.production.min.js 4.72 KiB [built] [code generated]
./src/index.js 3.64 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 3745 ms
-----> Caching build
- node_modules
-----> Pruning devDependencies
removed 473 packages and audited 64 packages in 2.943s
2 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 34.2M
-----> Launching...
Released v3
https://morning-sands-39344.herokuapp.com/ deployed to Heroku
Any ideas what is the issue?
These are my main setup files
webpack.config.js
const path = require('path')
// module.exports = {
// entry: './public/App.js',
// output: {
// filename: 'App.js',
// path: path.resolve(__dirname, 'dist'),
// },
// watch: true,
// mode: 'development',
// }
var config = {
watch: true,
mode: 'development',
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: [/\.js$/, /\.jsx$/],
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [
["#babel/preset-env", {
"targets": {
"ie": "11",
"edge": "15",
"safari": "10",
"firefox": "50",
"chrome": "49"
}
}],
"#babel/preset-react"
]
}
}
}
]
},
devtool : 'inline-source-map',
};
var fooConfig = Object.assign({}, config, {
//name: "a",
entry: './src/App.jsx',
output: {
filename: 'App.js',
path: path.resolve(__dirname, 'public/dist'),
},
});
var barConfig = Object.assign({}, config,{
entry: './src/Databases.jsx',
output: {
filename: 'Databases.js',
path: path.resolve(__dirname, 'public/dist'),
},
});
var booConfig = Object.assign({}, config,{
entry: './src/Matches.jsx',
output: {
filename: 'Matches.js',
path: path.resolve(__dirname, 'public/dist'),
},
});
var Config1 = Object.assign({}, config,{
entry: './src/AppDep/BuyOrders.jsx',
output: {
filename: 'BuyOrders.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config2 = Object.assign({}, config,{
entry: './src/AppDep/Edit.jsx',
output: {
filename: 'Edit.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config3 = Object.assign({}, config,{
entry: './src/AppDep/MakeBuy.jsx',
output: {
filename: 'MakeBuy.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config4 = Object.assign({}, config,{
entry: './src/AppDep/MakeSell.jsx',
output: {
filename: 'MakeSell.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config5 = Object.assign({}, config,{
entry: './src/AppDep/MyOrders.jsx',
output: {
filename: 'MyOrders.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config6 = Object.assign({}, config,{
entry: './src/AppDep/Order.jsx',
output: {
filename: 'Order.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config7 = Object.assign({}, config,{
entry: './src/AppDep/Prices.jsx',
output: {
filename: 'Prices.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config8 = Object.assign({}, config,{
entry: './src/AppDep/PricesComponent.jsx',
output: {
filename: 'PricesComponent.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config9 = Object.assign({}, config,{
entry: './src/AppDep/SellOrders.jsx',
output: {
filename: 'SellOrders.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config10 = Object.assign({}, config,{
entry: './src/AppDep/Navigation.jsx',
output: {
filename: 'Navigation.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config11 = Object.assign({}, config,{
entry: './src/AppDep/MatcheRow.jsx',
output: {
filename: 'MatcheRow.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
// Return Array of Configurations
module.exports = [
fooConfig, barConfig, booConfig, Config1, Config2, Config3, Config4, Config5, Config6, Config7, Config8, Config9, Config10, Config11
];
Thanks
Heroku uses Procfiles or the start command to start your server. Add a start command at the script section in your package.json that points to your nodejs server.
"script": {
"start": "node pathtoyourserver.js"
}
Or you can add a Procfile
web: node pathtoyourserver.js
or use your npm command
web: npm run server
https://devcenter.heroku.com/articles/nodejs-support

Error: Cannot find module './undefined' with discord-buttons, discord.js, TypeScrpit and webpack

I use TypeScript and Webpack for my Discord bot. It used to compile with no problems, until I tried to use discord-buttons.
I've found some questions and answers about discord.js, TypesScript and Webpack. But no one of them say something about discord-buttons.
The module.exports in my webpack config file looks like this:
entry: {
index: {
import: "./src/index.ts",
dependOn: ["discord", "buttons"]
},
discord: "discord.js",
buttons: "discord-buttons"
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist")
},
module: {
rules: [{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
}, ],
},
target: "node",
externals: [nodeExternals()],
My index.ts file does nothing with discord-buttons but importing it and using disbut
import { Client, Message, MessageEmbed, TextChannel } from "discord.js"
import disbut from 'discord-buttons'
const token:string = `token`
const client: Client = new Client()
disbut(client)
client.login(token)
When I build with Webpack (in development mode), it says there is no error, but I get one when I run the index.bundle.js
> webpack --mode development --config webpack.config.dev.js
asset index.bundle.js 75.4 KiB [emitted] (name: index)
asset buttons.bundle.js 6.75 KiB [compared for emit] (name: buttons)
asset discord.bundle.js 6.72 KiB [compared for emit] (name: discord)
runtime modules 5.42 KiB 16 modules
built modules 62.7 KiB [built]
cacheable modules 62.6 KiB
modules by path ./src/modules/*.ts 48.5 KiB
./src/modules/CommandManager.ts 19.8 KiB [built] [code generated]
./src/modules/OutputManager.ts 2.05 KiB [built] [code generated]
./src/modules/LogManager.ts 3.59 KiB [built] [code generated]
./src/modules/FirebaseManager.ts 17.9 KiB [built] [code generated]
./src/modules/SpikeChannels.ts 5.17 KiB [built] [code generated]
./src/index.ts 11.8 KiB [built] [code generated]
./spike-database-firebase-admin-ETC.json 2.26 KiB [built] [code generated]
external "discord.js" 42 bytes [built] [code generated]
external "discord-buttons" 42 bytes [built] [code generated]
external "fastest-levenshtein" 42 bytes [built] [code generated]
external "firebase-admin" 42 bytes [built] [code generated]
webpack 5.46.0 compiled successfully in 4242 ms
> spike-bot#1.0.0 bot
> node ./dist/index.bundle.js
node:internal/modules/cjs/loader:930
throw err;
^
Error: Cannot find module './undefined'
Require stack:
- /home/eban/PATH_TO_PROJECT/dist/discord.bundle.js
- /home/eban/PATH_TO_PROJECT/dist/index.bundle.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:927:15)
at Function.Module._load (node:internal/modules/cjs/loader:772:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.__webpack_require__.f.require (/home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:157:28)
at /home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:84:40
at Array.reduce (<anonymous>)
at Function.__webpack_require__.e (/home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:83:67)
at Array.map (<anonymous>)
at Function.__webpack_require__.X (/home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:121:22) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/PATH_TO_PROJECT/dist/discord.bundle.js',
'/home/PATH_TO_PROJECT/dist/index.bundle.js'
]
}
The problem seems to be that you added entry points for external modules, namely your discord and buttons entry points. Entry points should be for your own scripts, usually not externals. If you're not planning on running multiple processes, a single entry point is also all you need.

Running Gatsby JS with PM2

This post has been updated with new information based on debugging
I am attempting to do a deploy with pm2 for a GatsbyJS site on EC2. I previously was able to get Gatsby to run manually on ec2 with pm2, but not with a deploy.
Here is my ecosystem.config.js file
module.exports = {
apps : [{
name: 'wispyCo',
script: 'npm',
args : 'start',
watch: '.',
env:{
NODE_ENV: "production",
MY_SANITY_TOKEN : "fdsa",
SANITY_TOKEN_WRITE : "fdsaf",
SLACK_WEBHOOK_URL : "fds"
}
},
],
deploy : {
production : {
user : 'ubuntu',
host : 'ec2-54-226-83-78.compute-1.amazonaws.com',
ref : 'origin/development',
repo : 'git#github.com:fdsafa',
path : '/home/ubuntu/wispyDeploy',
'pre-deploy-local': '',
'post-deploy' : 'npm install && pm2 reload ecosystem.config.js --env production',
'pre-setup': '',
}
}
};
Here is my scripts for package.json for Gatsby
"scripts": {
"develop": "gatsby develop -H 0.0.0.0 --port 8000",
"start": "run-p start:**",
"start:app": "npm run develop",
"start:lambda": "netlify-lambda serve src/lambda",
"build": "gatsby build && netlify-lambda build src/lambda",
"build:app": "gatsby build",
"build:lambda": "netlify-lambda build src/lambda"
}
What's happening is pm2 just keeps reloading which looks something like this.
PM2 | 2020-05-07T13:29:35: PM2 log: pid=31900 msg=process killed
PM2 | 2020-05-07T13:29:35: PM2 log: App [wispyCo:0] starting in -fork mode-
PM2 | 2020-05-07T13:29:35: PM2 log: App [wispyCo:0] online
PM2 | 2020-05-07T13:29:37: PM2 log: Change detected on path lambda/hello.js for app wispyCo - restarting
PM2 | 2020-05-07T13:29:37: PM2 log: Stopping app:wispyCo id:0
PM2 | 2020-05-07T13:29:37: PM2 log: App [wispyCo:0] exited with code [0] via signal [SIGINT]
PM2 | 2020-05-07T13:29:38: PM2 log: pid=32016 msg=process killed
PM2 | 2020-05-07T13:29:38: PM2 log: App [wispyCo:0] starting in -fork mode-
PM2 | 2020-05-07T13:29:38: PM2 log: App [wispyCo:0] online
PM2 | 2020-05-07T13:29:40: PM2 log: Change detected on path lambda/hello.js for app wispyCo - restarting
PM2 | 2020-05-07T13:29:40: PM2 log: Stopping app:wispyCo id:0
PM2 | 2020-05-07T13:29:40: PM2 log: App [wispyCo:0] exited with code [0] via signal [SIGINT]
PM2 | 2020-05-07T13:29:40: PM2 log: pid=32132 msg=process killed
PM2 | 2020-05-07T13:29:40: PM2 log: App [wispyCo:0] starting in -fork mode-
PM2 | 2020-05-07T13:29:40: PM2 log: App [wispyCo:0] online
/home/ubuntu/.pm2/logs/wispyCo-error.log last 15 lines:
/home/ubuntu/.pm2/logs/wispyCo-out.log last 15 lines:
0|wispyCo | > run-p start:**
0|wispyCo |
0|wispyCo |
0|wispyCo | > gatsby-starter-default#0.1.0 start:app /home/ubuntu/wispyDeploy/source
0|wispyCo | > npm run develop
0|wispyCo |
0|wispyCo |
0|wispyCo | > gatsby-starter-default#0.1.0 start:lambda /home/ubuntu/wispyDeploy/source
0|wispyCo | > netlify-lambda serve src/lambda
0|wispyCo |
0|wispyCo |
0|wispyCo | > gatsby-starter-default#0.1.0 develop /home/ubuntu/wispyDeploy/source
0|wispyCo | > gatsby develop -H 0.0.0.0 --port 8000
0|wispyCo |
0|wispyCo | netlify-lambda: Starting server
PM2 | Change detected on path lambda/hello.js for app wispyCo - restarting
PM2 | Stopping app:wispyCo id:0
0|wispyCo | Hash: d0c09734a446097dbcc4
0|wispyCo | Version: webpack 4.41.5
0|wispyCo | Time: 1141ms
0|wispyCo | Built at: 05/07/2020 1:29:43 PM
0|wispyCo | Asset Size Chunks Chunk Names
0|wispyCo | hello.js 131 KiB 0 [emitted] hello
0|wispyCo | slack.js 277 KiB 1 [emitted] slack
0|wispyCo | Entrypoint hello = hello.js
0|wispyCo | Entrypoint slack = slack.js
0|wispyCo | [0] /home/ubuntu/wispyDeploy/source/node_modules/object-assign/index.js 2.06 KiB {0} [built]
0|wispyCo | [2] external "stream" 42 bytes {0} {1} [built]
0|wispyCo | [3] external "url" 42 bytes {0} {1} [built]
0|wispyCo | [5] external "http" 42 bytes {0} {1} [built]
0|wispyCo | [8] external "https" 42 bytes {0} {1} [built]
0|wispyCo | [14] external "fs" 42 bytes {0} {1} [built]
0|wispyCo | [15] /home/ubuntu/wispyDeploy/source/node_modules/#sanity/observable/operators/filter.js 66 bytes {0} [built]
0|wispyCo | [16] /home/ubuntu/wispyDeploy/source/node_modules/#sanity/observable/operators/map.js 57 bytes {0} [built]
0|wispyCo | [18] /home/ubuntu/wispyDeploy/source/node_modules/dotenv/lib/main.js 2.93 KiB {0} {1} [built]
0|wispyCo | [19] external "path" 42 bytes {0} {1} [built]
0|wispyCo | [23] external "querystring" 42 bytes {0} {1} [built]
0|wispyCo | [58] /home/ubuntu/wispyDeploy/source/node_modules/node-fetch/index.js 7.93 KiB {1} [built]
0|wispyCo | [59] ./hello.js 1.79 KiB {0} [built]
0|wispyCo | [60] /home/ubuntu/wispyDeploy/source/node_modules/#sanity/client/lib/sanityClient.js 3.43 KiB {0} [built]
0|wispyCo | [155] ./slack.js 1000 bytes {1} [built]
0|wispyCo | + 165 hidden modules
0|wispyCo | WARNING in /home/ubuntu/wispyDeploy/source/node_modules/encoding/lib/iconv-loader.js 9:12-34
0|wispyCo | Critical dependency: the request of a dependency is an expression
0|wispyCo | # /home/ubuntu/wispyDeploy/source/node_modules/encoding/lib/encoding.js
0|wispyCo | # /home/ubuntu/wispyDeploy/source/node_modules/node-fetch/lib/body.js
0|wispyCo | # /home/ubuntu/wispyDeploy/source/node_modules/node-fetch/index.js
0|wispyCo | # ./slack.js
PM2 | App [wispyCo:0] exited with code [0] via signal [SIGINT]
PM2 | pid=32248 msg=process killed
PM2 | App [wispyCo:0] starting in -fork mode-
PM2 | App [wispyCo:0] online
0|wispyCo | > gatsby-starter-default#0.1.0 start /home/ubuntu/wispyDeploy/source
0|wispyCo | > run-p start:**
0|wispyCo | > gatsby-starter-default#0.1.0 start:lambda /home/ubuntu/wispyDeploy/source
0|wispyCo | > netlify-lambda serve src/lambda
0|wispyCo | > gatsby-starter-default#0.1.0 start:app /home/ubuntu/wispyDeploy/source
0|wispyCo | > npm run develop
0|wispyCo | > gatsby-starter-default#0.1.0 develop /home/ubuntu/wispyDeploy/source
0|wispyCo | > gatsby develop -H 0.0.0.0 --port 8000
0|wispyCo | netlify-lambda: Starting server
The pm2.log looks like the following
2020-05-07T13:31:26: PM2 log: Change detected on path lambda/hello.js for app wispyCo - restarting
2020-05-07T13:31:26: PM2 log: Stopping app:wispyCo id:0
2020-05-07T13:31:26: PM2 log: App [wispyCo:0] exited with code [0] via signal [SIGINT]
2020-05-07T13:31:26: PM2 log: pid=4137 msg=process killed
2020-05-07T13:31:26: PM2 log: App [wispyCo:0] starting in -fork mode-
2020-05-07T13:31:26: PM2 log: App [wispyCo:0] online
The is no error.log but the is a out.log which looks like the following which is just pm2 restarting again
> gatsby-starter-default#0.1.0 start /home/ubuntu/wispyDeploy/source
> run-p start:**
> gatsby-starter-default#0.1.0 start:lambda /home/ubuntu/wispyDeploy/source
> netlify-lambda serve src/lambda
> gatsby-starter-default#0.1.0 start:app /home/ubuntu/wispyDeploy/source
> npm run develop
> gatsby-starter-default#0.1.0 develop /home/ubuntu/wispyDeploy/source
> gatsby develop -H 0.0.0.0 --port 8000
netlify-lambda: Starting server
Hash: d0c09734a446097dbcc4
Version: webpack 4.41.5
Time: 1117ms
Built at: 05/07/2020 1:35:58 PM
Asset Size Chunks Chunk Names
hello.js 131 KiB 0 [emitted] hello
slack.js 277 KiB 1 [emitted] slack
Entrypoint hello = hello.js
Entrypoint slack = slack.js
[0] /home/ubuntu/wispyDeploy/source/node_modules/object-assign/index.js 2.06 KiB {0} [built]
[2] external "stream" 42 bytes {0} {1} [built]
[3] external "url" 42 bytes {0} {1} [built]
[5] external "http" 42 bytes {0} {1} [built]
[8] external "https" 42 bytes {0} {1} [built]
[14] external "fs" 42 bytes {0} {1} [built]
[15] /home/ubuntu/wispyDeploy/source/node_modules/#sanity/observable/operators/filter.js 66 bytes {0} [built]
[16] /home/ubuntu/wispyDeploy/source/node_modules/#sanity/observable/operators/map.js 57 bytes {0} [built]
[18] /home/ubuntu/wispyDeploy/source/node_modules/dotenv/lib/main.js 2.93 KiB {0} {1} [built]
[19] external "path" 42 bytes {0} {1} [built]
[23] external "querystring" 42 bytes {0} {1} [built]
[58] /home/ubuntu/wispyDeploy/source/node_modules/node-fetch/index.js 7.93 KiB {1} [built]
[59] ./hello.js 1.79 KiB {0} [built]
[60] /home/ubuntu/wispyDeploy/source/node_modules/#sanity/client/lib/sanityClient.js 3.43 KiB {0} [built]
[155] ./slack.js 1000 bytes {1} [built]
+ 165 hidden modules
WARNING in /home/ubuntu/wispyDeploy/source/node_modules/encoding/lib/iconv-loader.js 9:12-34
Critical dependency: the request of a dependency is an expression
# /home/ubuntu/wispyDeploy/source/node_modules/encoding/lib/encoding.js
# /home/ubuntu/wispyDeploy/source/node_modules/node-fetch/lib/body.js
# /home/ubuntu/wispyDeploy/source/node_modules/node-fetch/index.js
# ./slack.js
Lambda server is listening on 9000
> gatsby-starter-default#0.1.0 start /home/ubuntu/wispyDeploy/source
> run-p start:**
What ended up working for me was the following I removed cluster mode, changed watch to false and change the nod env to development in two places
module.exports = {
apps: [
{
name: "wispyCo",
script: "npm",
args: "start",
watch: false,
env: {
NODE_ENV: "development",
SANITY_TOKEN:
"fdsf",
SENDGRID_API_KEY:
"fsdafs",
SENDGRID_TO_EMAIL: "fdsfa.org",
},
},
],
deploy: {
production: {
user: "ubuntu",
host: "fdsaf.amazonaws.com",
ref: "origin/development",
repo: "git#github.com:fdsfa.git",
path: "/home/ubuntu/wispyDeploy",
"pre-deploy-local": "",
"post-deploy":
"npm install && pm2 reload ecosystem.config.js --env development && npm install -g gatsby-cli",
"pre-setup": "",
},
},
}

Deploy Nodejs+Express+React+Webpack app on heroku

I have made a web app using node js, express, webpack, react and socket io and I would like to deploy it on heroku. When I try it I can access to the website but it shows me an error message:
Cannot GET /
Here is my configuration:
"scripts": {
"start": "npm run dev",
"build": "webpack --mode production",
"client": "webpack-dev-server --mode development --devtool inline-source-map --hot",
"server": "nodemon src/server/index.js",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install && npm run build"
}
The start script was node src/server/index.js before I change it because I run npm run dev to start my app locally.
Here is my repository: http://git.kamal-allali.fr/kamal/prog_web_5a
Here is the heroku link: https://fast-earth-60949.herokuapp.com
Here are the heroku logs:
2018-11-05T21:42:44.984679+00:00 app[web.1]: 1 Built at: 11/05/2018 9:42:44 PM
2018-11-05T21:42:44.984681+00:00 app[web.1]: 1 Asset
Size Chunks Chunk Names
2018-11-05T21:42:44.984683+00:00 app[web.1]: 1 bundle.js 7.42
MiB main [emitted] main
2018-11-05T21:42:44.984685+00:00 app[web.1]: 1 favicon.ico 40.4
KiB [emitted]
2018-11-05T21:42:44.984686+00:00 app[web.1]: 1 index.html 717
bytes [emitted]
2018-11-05T21:42:44.984688+00:00 app[web.1]: 1 Entrypoint main =
bundle.js
2018-11-05T21:42:44.984710+00:00 app[web.1]: 1
[./node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
2018-11-05T21:42:44.984712+00:00 app[web.1]: 1
[./node_modules/react-dom/index.js] 1.33 KiB {main} [built]
2018-11-05T21:42:44.984713+00:00 app[web.1]: 1
[./node_modules/react/index.js] 190 bytes {main} [built]
2018-11-05T21:42:44.984715+00:00 app[web.1]: 1
[./node_modules/url/url.js] 22.8 KiB {main} [built]
2018-11-05T21:42:44.984718+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/index.js?http://localhost:3000]
(webpack)-dev-server/client?http://localhost:3000 7.78 KiB {main}
[built]
2018-11-05T21:42:44.984720+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/overlay.js]
(webpack)-dev-server/client/overlay.js 3.58 KiB {main} [built]
2018-11-05T21:42:44.984723+00:00 app[web.1]: 1 [0] multi
(webpack)-dev-server/client?http://localhost:3000
(webpack)/hot/dev-server.js ./src/client/index.js 52 bytes {main}
[built]
2018-11-05T21:42:44.984724+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/socket.js]
(webpack)-dev-server/client/socket.js 1.05 KiB {main} [built]
2018-11-05T21:42:44.984726+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js]
(webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {main}
[built]
2018-11-05T21:42:44.984728+00:00 app[web.1]: 1
[./node_modules/webpack/hot sync ^./log$] (webpack)/hot sync
nonrecursive ^./log$ 170 bytes {main} [built]
2018-11-05T21:42:44.984730+00:00 app[web.1]: 1
[./node_modules/webpack/hot/dev-server.js] (webpack)/hot/dev-server.js
1.61 KiB {main} [built]
2018-11-05T21:42:44.984732+00:00 app[web.1]: 1
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75
bytes {main} [built]
2018-11-05T21:42:44.984733+00:00 app[web.1]: 1
[./node_modules/webpack/hot/log-apply-result.js]
(webpack)/hot/log-apply-result.js 1.27 KiB {main} [built]
2018-11-05T21:42:44.984735+00:00 app[web.1]: 1
[./src/client/Layout.js] 4.33 KiB {main} [built]
2018-11-05T21:42:44.984736+00:00 app[web.1]: 1
[./src/client/index.js] 205 bytes {main} [built]
2018-11-05T21:42:44.984738+00:00 app[web.1]: 1 + 349 hidden
modules
2018-11-05T21:42:44.984740+00:00 app[web.1]: 1 Child
html-webpack-plugin for "index.html":
2018-11-05T21:42:44.984742+00:00 app[web.1]: 1 1 asset
2018-11-05T21:42:44.984743+00:00 app[web.1]: 1 Entrypoint
undefined = index.html
2018-11-05T21:42:44.984745+00:00 app[web.1]: 1
[./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html]
828 bytes {0} [built]
2018-11-05T21:42:44.984746+00:00 app[web.1]: 1
[./node_modules/lodash/lodash.js] 527 KiB {0}
[built]2018-11-05T21:42:44.984748+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js
489 bytes {0} [built]
2018-11-05T21:42:44.984749+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js
497 bytes {0} [built]
2018-11-05T21:42:44.984751+00:00 app[web.1]: 1 ℹ 「wdm」: Compiled
successfully.
2018-11-05T22:16:20.551630+00:00 heroku[web.1]: Idling
2018-11-05T22:16:20.552092+00:00 heroku[web.1]: State changed from up
to down
2018-11-05T22:16:21.411951+00:00 heroku[web.1]: Stopping all processes
with SIGTERM
2018-11-05T22:16:21.808625+00:00 heroku[web.1]: Process exited with
status 143
2018-11-06T08:35:42.000000+00:00 app[api]: Build started by user
kamal.allali#outlook.fr
2018-11-06T08:36:36.888512+00:00 heroku[web.1]: State changed from
down to starting
2018-11-06T08:36:36.713630+00:00 app[api]: Deploy d62783d3 by user
kamal.allali#outlook.fr
2018-11-06T08:36:36.713630+00:00 app[api]: Release v12 created by user
kamal.allali#outlook.fr
2018-11-06T08:36:40.000000+00:00 app[api]: Build succeeded
2018-11-06T08:36:42.010068+00:00 heroku[web.1]: Starting process with
command npm start
2018-11-06T08:36:45.324322+00:00 app[web.1]:
2018-11-06T08:36:45.324353+00:00 app[web.1]: > projet-web-5a#1.0.0
start /app
2018-11-06T08:36:45.324355+00:00 app[web.1]: > npm run dev
2018-11-06T08:36:45.324356+00:00 app[web.1]:
2018-11-06T08:36:45.753063+00:00 app[web.1]:
2018-11-06T08:36:45.753112+00:00 app[web.1]: > projet-web-5a#1.0.0 dev
/app
2018-11-06T08:36:45.753114+00:00 app[web.1]: > concurrently "npm run
server" "npm run client"
2018-11-06T08:36:45.753116+00:00 app[web.1]:
2018-11-06T08:36:47.147860+00:00 app[web.1]: 1
2018-11-06T08:36:47.147877+00:00 app[web.1]: 1 > projet-web-5a#1.0.0
client /app
2018-11-06T08:36:47.147879+00:00 app[web.1]: 1 > webpack-dev-server
--mode development --devtool inline-source-map --hot
2018-11-06T08:36:47.147881+00:00 app[web.1]: 1
2018-11-06T08:36:47.172481+00:00 app[web.1]: [0]
2018-11-06T08:36:47.172485+00:00 app[web.1]: [0] > projet-web-5a#1.0.0
server /app
2018-11-06T08:36:47.172487+00:00 app[web.1]: [0] > nodemon
src/server/index.js
2018-11-06T08:36:47.172488+00:00 app[web.1]: [0]
2018-11-06T08:36:47.672353+00:00 app[web.1]: [0] [nodemon] 1.18.4
2018-11-06T08:36:47.673281+00:00 app[web.1]: [0] [nodemon] to restart
at any time, enter rs
2018-11-06T08:36:47.673747+00:00 app[web.1]: [0] [nodemon] watching:
/app/src/server/**/*
2018-11-06T08:36:47.674424+00:00 app[web.1]: [0] [nodemon] starting
node src/server/index.js
2018-11-06T08:36:47.963706+00:00 app[web.1]: [0] Listening on port
45437
2018-11-06T08:36:48.299567+00:00 heroku[web.1]: State changed from
starting to up
2018-11-06T08:36:48.679674+00:00 app[web.1]: 1 clean-webpack-plugin:
/app/dist has been removed.
2018-11-06T08:36:48.905698+00:00 app[web.1]: 1 ℹ 「wds」: Project is
running at http://localhost:3000/
2018-11-06T08:36:48.906031+00:00 app[web.1]: 1 ℹ 「wds」: webpack
output is served from /
2018-11-06T08:36:48.956210+00:00 app[web.1]: 1 ⚠ 「wds」: Unable to
open browser. If you are running in a headless environment, please do
not use the --open flag
2018-11-06T08:36:55.276089+00:00 heroku[router]: at=info method=GET
path="/" host=fast-earth-60949.herokuapp.com
request_id=2474b83b-65ce-43b4-a54f-6851d5f55a7c fwd="78.112.168.129"
dyno=web.1 connect=0ms service=9ms status=404 bytes=360 protocol=https
2018-11-06T08:36:57.303048+00:00 app[web.1]: 1 ℹ 「wdm」: Hash:
6de9947fac0c16b70883
2018-11-06T08:36:57.303058+00:00 app[web.1]: 1 Version: webpack
4.19.1
2018-11-06T08:36:57.303061+00:00 app[web.1]: 1 Time: 8512ms
2018-11-06T08:36:57.303063+00:00 app[web.1]: 1 Built at: 11/06/2018
8:36:57 AM
2018-11-06T08:36:57.303066+00:00 app[web.1]: 1 Asset
Size Chunks Chunk Names
2018-11-06T08:36:57.303069+00:00 app[web.1]: 1 bundle.js 7.42
MiB main [emitted] main
2018-11-06T08:36:57.303071+00:00 app[web.1]: 1 favicon.ico 40.4
KiB [emitted]
2018-11-06T08:36:57.303073+00:00 app[web.1]: 1 index.html 717
bytes [emitted]
2018-11-06T08:36:57.303074+00:00 app[web.1]: 1 Entrypoint main =
bundle.js
2018-11-06T08:36:57.303077+00:00 app[web.1]: 1
[./node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
2018-11-06T08:36:57.303078+00:00 app[web.1]: 1
[./node_modules/react-dom/index.js] 1.33 KiB {main} [built]
2018-11-06T08:36:57.303080+00:00 app[web.1]: 1
[./node_modules/react/index.js] 190 bytes {main} [built]
2018-11-06T08:36:57.303082+00:00 app[web.1]: 1
[./node_modules/url/url.js] 22.8 KiB {main} [built]
2018-11-06T08:36:57.303084+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/index.js?http://localhost:3000]
(webpack)-dev-server/client?http://localhost:3000 7.78 KiB {main}
[built]
2018-11-06T08:36:57.303087+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/overlay.js]
(webpack)-dev-server/client/overlay.js 3.58 KiB {main} [built]
2018-11-06T08:36:57.303090+00:00 app[web.1]: 1 [0] multi
(webpack)-dev-server/client?http://localhost:3000
(webpack)/hot/dev-server.js ./src/client/index.js 52 bytes {main}
[built]
2018-11-06T08:36:57.303091+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/socket.js]
(webpack)-dev-server/client/socket.js 1.05 KiB {main} [built]
2018-11-06T08:36:57.303093+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js]
(webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {main}
[built]
2018-11-06T08:36:57.303095+00:00 app[web.1]: 1
[./node_modules/webpack/hot sync ^./log$] (webpack)/hot sync
nonrecursive ^./log$ 170 bytes {main} [built]
2018-11-06T08:36:57.303099+00:00 app[web.1]: 1
[./node_modules/webpack/hot/dev-server.js] (webpack)/hot/dev-server.js
1.61 KiB {main} [built]
2018-11-06T08:36:57.303100+00:00 app[web.1]: 1
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75
bytes {main} [built]
2018-11-06T08:36:57.303102+00:00 app[web.1]: 1
[./node_modules/webpack/hot/log-apply-result.js]
(webpack)/hot/log-apply-result.js 1.27 KiB {main} [built]
2018-11-06T08:36:57.303104+00:00 app[web.1]: 1
[./src/client/Layout.js] 4.33 KiB {main} [built]
2018-11-06T08:36:57.303106+00:00 app[web.1]: 1
[./src/client/index.js] 205 bytes {main} [built]
2018-11-06T08:36:57.303108+00:00 app[web.1]: 1 + 349 hidden
modules
2018-11-06T08:36:57.303109+00:00 app[web.1]: 1 Child
html-webpack-plugin for "index.html":
2018-11-06T08:36:57.303111+00:00 app[web.1]: 1 1 asset
2018-11-06T08:36:57.303113+00:00 app[web.1]: 1 Entrypoint
undefined = index.html
2018-11-06T08:36:57.303115+00:00 app[web.1]: 1
[./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html]
828 bytes {0} [built]
2018-11-06T08:36:57.303116+00:00 app[web.1]: 1
[./node_modules/lodash/lodash.js] 527 KiB {0}
[built]2018-11-06T08:36:57.303118+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js
489 bytes {0} [built]
2018-11-06T08:36:57.303119+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js
497 bytes {0} [built]
2018-11-06T08:36:57.303457+00:00 app[web.1]: 1 ℹ 「wdm」: Compiled
successfully.
You need to add your node version to your package.json.
Example:
"engines": {
"node": "10.11.0"
}
I answered in the comments but it is not the best way so I'll edit here.
Since you are trying to serve static content try with the static middleware.
Remove
app.get('*', (req,res) =>{
res.sendFile(path.join(__dirname,'../../public/index.html'));
});
And add
app.use(express.static(path.join(__dirname,'../../public')));
Second edit.
You need to build your project and serve the folder, usually is a dist or build folder.
To do this you have a couple of options, one is to build the project before publishing your changes to heroku but it can get a bit tedious.
The other option is to do a postinstall script so after heroku executes npm install the project gets built and the dist or build folder created with the latest changes.
"postinstall": "npm run build"
If you don't want the script to run everytime you do npm install you can use if-env with an environtment variable in heroku.
"postinstall": "if-env NODE_ENV=production && npm run build"
Once you know what folder is being created when building change the next line.
app.use(express.static(path.join(__dirname,'path to the folder with the prod build')));
Without the Heroku logs, its kinda of a speculation...BUT
Cannot GET / - means express is not answering to the path..
Heroku is serving NodeJs using express and thats where the bug should be
From checking the code in server/index.js you are using path package and forgot to import it :)
const path = require('path');
Once you fix that you will also need to add a condition to reach DIST folder and not public (As you will be serving the DIST folder)
if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, 'build')));
app.get('*', function (req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
}
*Also check dist is loading and is not on .gitignore
Good luck!

Webpack returns error in CI - TS2688: Cannot find type definition file for 'reflect-metadata'

I have a simple nodejs dictionary application that use webpack for client side module management and concatination of scripts. Everything works fine in my local machine. Now I am doing some experiments with CI in Azure. During this experiments with Azure's continous delivery options using CI from visualstudio.com, I have encounter the following error when executing webpack task (I am using the webpack task from the marketplace). Can anyone help me out?
The webpack build task specific log file says:
2017-07-31T13:44:16.2307812Z ##[section]Starting: webpack
2017-07-31T13:44:16.2307812Z ==============================================================================
2017-07-31T13:44:16.2307812Z Task : webpack
2017-07-31T13:44:16.2307812Z Description : bundle your assets, scripts, images, styles
2017-07-31T13:44:16.2307812Z Version : 3.0.19
2017-07-31T13:44:16.2307812Z Author : Dealogic
2017-07-31T13:44:16.2307812Z Help : [More information](https://marketplace.visualstudio.com/items?itemName=Dealogic.webpack-vsts-extension) [webpack](https://webpack.github.io/)
2017-07-31T13:44:16.2307812Z ==============================================================================
2017-07-31T13:44:16.4428024Z webpack
2017-07-31T13:44:16.4447837Z webpackConfigLocation: ./webpack.browser.config.js
2017-07-31T13:44:16.4447837Z treatErrorsAs: warnings
2017-07-31T13:44:16.4447837Z treatWarningsAs: warnings
2017-07-31T13:44:16.4447837Z workingFolder: d:\a\1\s
2017-07-31T13:44:16.4447837Z webpackModuleLocation: null
2017-07-31T13:44:16.4457843Z webpack module resolution started
2017-07-31T13:44:16.7987854Z webpack module resolution finished
2017-07-31T13:44:16.7987854Z webpack config resolution started
2017-07-31T13:44:16.7997851Z webpack config resolution finished
2017-07-31T13:44:16.7997851Z compilation of the webpack project is started
2017-07-31T13:44:17.3707894Z
2017-07-31T13:44:17.3707894Z [at-loader] Using typescript#2.4.2 from typescript and "tsconfig.json" from d:\a\1\s\client\tsconfig.json.
2017-07-31T13:44:17.3707894Z
2017-07-31T13:44:19.1378300Z
2017-07-31T13:44:19.1378300Z [at-loader] Checking started in a separate process...
2017-07-31T13:44:19.5368391Z
2017-07-31T13:44:19.5368391Z [at-loader] Checking finished with 1 errors
2017-07-31T13:44:19.5428397Z compilation of the webpack project is done
2017-07-31T13:44:19.5498387Z Hash: 1f80fddb56bf16ebb0f6
2017-07-31T13:44:19.5498387Z Version: webpack 3.4.1
2017-07-31T13:44:19.5498387Z Time: 2631ms
2017-07-31T13:44:19.5498387Z Asset Size Chunks Chunk Names
2017-07-31T13:44:19.5498387Z app-bundle.js 146 kB 0 [emitted] main
2017-07-31T13:44:19.5498387Z app-bundle.js.map 179 kB 0 [emitted] main
2017-07-31T13:44:19.5498387Z [4] ./node_modules/inversify/lib/annotation/decorator_utils.js 2.56 kB {0} [built]
2017-07-31T13:44:19.5498387Z [5] ./node_modules/inversify/lib/utils/guid.js 352 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [7] ./node_modules/inversify/lib/inversify.js 1.93 kB {0} [built]
2017-07-31T13:44:19.5498387Z [8] ./client/src/Dependency/DependencyIdentifiers.js 395 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [11] ./node_modules/reflect-metadata/Reflect.js 48 kB {0} [built]
2017-07-31T13:44:19.5498387Z [14] ./node_modules/inversify/lib/syntax/constraint_helpers.js 1.48 kB {0} [built]
2017-07-31T13:44:19.5498387Z [15] ./node_modules/inversify/lib/planning/metadata_reader.js 962 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [16] ./client/src/index.ts 1.29 kB {0} [built]
2017-07-31T13:44:19.5498387Z [17] ./client/src/Dependency/DependencyManager.js 983 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [18] ./client/src/Services/WordFetcherImpl.js 2.18 kB {0} [built]
2017-07-31T13:44:19.5498387Z [45] ./node_modules/inversify/lib/annotation/post_construct.js 722 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [46] ./node_modules/process/browser.js 5.42 kB {0} [built]
2017-07-31T13:44:19.5498387Z [48] ./client/src/Utils/UriUtils.js 356 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [49] ./client/src/Services/OxfordHelper.js 1.29 kB {0} [built]
2017-07-31T13:44:19.5498387Z [50] ./client/src/Services/DictionaryService.js 2.13 kB {0} [built]
2017-07-31T13:44:19.5498387Z + 36 hidden modules
2017-07-31T13:44:19.5498387Z
2017-07-31T13:44:19.5498387Z ERROR in [at-loader] TS2688: Cannot find type definition file for 'reflect-metadata'.
2017-07-31T13:44:19.5568407Z ##[warning]webpack partially succeeded
2017-07-31T13:44:19.5568407Z ##[warning]webpack: [at-loader] TS2688: Cannot find type definition file for 'reflect-metadata'.
2017-07-31T13:44:19.5568407Z webpack summary section markdown file creation is started
2017-07-31T13:44:19.5568407Z webpack sumamry section markdown file is created with the name 'd:\a\1\s\webpack.webpack.result.md'
2017-07-31T13:44:20.0895996Z ##[section]Finishing: webpack
Here is the dependencies fragment from the package.json
"dependencies": {
"async": "^2.5.0",
"compression": "^1.7.0",
"express": "^4.15.3",
"inversify": "^4.2.0",
"reflect-metadata": "^0.1.10",
"request": "^2.81.0"
},
"devDependencies": {
"#types/async": "^2.0.40",
"#types/compression": "0.0.33",
"#types/express": "^4.0.36",
"#types/jasmine": "^2.5.53",
"#types/node": "^8.0.14",
"#types/request": "^2.0.0",
"awesome-typescript-loader": "^3.2.1",
"jasmine": "^2.6.0",
"jasmine-console-reporter": "^1.2.7",
"typescript": "*",
"typings": "^2.1.1",
"webpack": "^3.0.0"
}
What could be wrong?
Try installing reflect-metadata #types: https://www.npmjs.com/package/#types/reflect-metadata
npm i -D #types/reflect-metadata
Maybe you should add it on tsconfig.json, depends on your current configuration.
It was more of a MS TFS issue. When I changed Agent from "Hosted VS2017" to "Hosted Linux Preview" everything worked fine!
Not sure what is going on under the hood.

Resources