Prerequisites
On a fresh clone of reaction-development-platform, after running make, the reaction container fails to start with the following error:
ERROR Reaction: Cannot find module /usr/local/src/app/plugins.json imported from /usr/local/src/app/node_modules/@reactioncommerce/api-core/src/importPluginsJSONFile.js
Error: Cannot find module /usr/local/src/app/plugins.json imported from /usr/local/src/app/node_modules/@reactioncommerce/api-core/src/importPluginsJSONFile.js
at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:84:13)
at Loader.resolve (internal/modules/esm/loader.js:73:33)
at Loader.getModuleJob (internal/modules/esm/loader.js:147:40)
at Loader.import (internal/modules/esm/loader.js:131:28)
at importModuleDynamically (internal/modules/esm/translators.js:75:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node --experimental-modules --experimental-json-modules ./src/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The same issue happens when running docker build .. However, the issue does not happen when running reaction in development mode make dev-link-reaction. This lead me to believe that the Dockerfile needs some kind of an update to work with the new plugins.json file.
reaction-development-platform (making sure to make clean any previous platform to wipe volumes)makereaction_api_1 and notice the error being thrown.docker build . and notice the same error.make dev-link-reaction && make start-reaction and notice reaction starting up fine.Tweak something in the Dockerfile to make the plugins.json file work. Maybe it's not being copied into the container?
3.7.0
I think node-prod image might copy only src folder, so we need to add an explicit copy of the JSON in https://github.com/reactioncommerce/reaction/blob/trunk/Dockerfile, or move the JSON file into /src. I can look into a fix later today.
As noted in the description, you can run make dev-reaction after make to work around this issue for now.
Food for thought, there should be some kind of CI tests for the release of new images on Docker Hub. It would ensure that things like this don't happen.
FYI, this is the same error I just discovered in https://github.com/reactioncommerce/reaction-development-platform/issues/128
@loan-laux Completely agree. This would theoretically have been visible in the trunk build immediately after the JSON file PR was merged. @manueldelreal had been working on a version of the integration tests that could be run against a prod image, so we may be able to run those either in CI or on a nightly cycle. Really all we need is one test with one GraphQL query against the running image and we would know startup failed.
(Also I think I actually got this error once before the release but I was messing around with plugin linking and didn't realize the significance of it.)
Is there a quick workaround I can use until this gets fixed? Like previous release tag on the api container maybe? Should that work?
@jshimko For running locally, just make dev-reaction command in the development platform dir should work, or change api.image to reactioncommerce/reaction:3.6.0 in docker-compose.yml. For prod, use reactioncommerce/reaction:3.6.0 image tag.
Thanks! Confirmed reverting to reactioncommerce/reaction:3.6.0 works.
Will be in 3.7.1 release
Most helpful comment
Will be in 3.7.1 release