apostrophe
apostrophe copied to clipboard
3.0: Apostrophe crashes on start if piece exists in db but is not configured in code
The problem to solve
Hard crashing in this scenario makes it unnecessarily difficult to switch among branches that might have new/different doc types.
Proposed solution
This should be a warning and not result in app crash
Full output
Error: The aposDocs mongodb collection contains docs with the type recipe
but there is no module that manages that type. You must implement
a module of that name that extends @apostrophecms/piece-type or
@apostrophecms/page-type, or remove these documents from the
database.
at Object.manageOrphans (/Users/sdr/src/apostrophe/modules/@apostrophecms/page/index.js:370:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.emit (/Users/sdr/src/apostrophe/modules/@apostrophecms/module/lib/events.js:41:13)
at async module.exports (/Users/sdr/src/apostrophe/index.js:105:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `node app @apostrophecms/asset:build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/sdr/.npm/_logs/2020-09-25T13_20_14_565Z-debug.log
[nodemon] app crashed - waiting for file changes before starting...