Seeding database fails
See original GitHub issueIf I try to seed a database it fails. How to reproduce:
docker-compose down
# make sure none of the related containers are runningdocker system prune -a
# remove all stopped containers, images and networks not in usedocker-compose run --rm freecodecamp npm install
# install depsdocker-compose run --rm freecodecamp npm run only-once
# seed
Of interest is that entities not found, db may not be properly seeded
is ironic when you try to seed a db 😉
Related but not identical #17256 -which shows a timeout connecting to the db, while my setup connects to the db just fine (fcc:server db connected +0ms
).
▶ docker-compose run --rm freecodecamp npm run only-once
Starting freecodecamp_mailhog_1 ... done
Starting freecodecamp_db_1 ... done
> freecodecamp@0.1.0 only-once /app
> npm run prelint-js && echo '/****/' && echo 'Seeding Database' && echo '/****/' && node seed/index.js && echo '/****/' && echo 'Seeding Completed' && echo '/****/'
> freecodecamp@0.1.0 prelint-js /app
> npm run ensure-env
> freecodecamp@0.1.0 ensure-env /app
> node ./config/ensure-env.js
rev-manifest present
pathMigration present
/****/
Seeding Database
/****/
Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class
Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
fcc:server db connected +0ms
/app/node_modules/loopback-connector-mongodb/node_modules/mongodb/lib/utils.js:123
process.nextTick(function() { throw err; });
^
Error: Error: entities not found, db may not be properly seeded
at AnonymousObserver._onError (/app/server/boot/home.js:18:21)
at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.error (/app/node_modules/rx/dist/rx.js:1836:12)
at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onError (/app/node_modules/rx/dist/rx.js:1772:14)
at AnonymousObserver.o.onError (/app/node_modules/rx/dist/rx.js:1999:22)
at AnonymousObserver.tryCatcher (/app/node_modules/rx/dist/rx.js:63:31)
at AutoDetachObserverPrototype.error (/app/node_modules/rx/dist/rx.js:5891:52)
at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onError (/app/node_modules/rx/dist/rx.js:1772:14)
at InnerObserver.error (/app/node_modules/rx/dist/rx.js:4530:14)
at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onError (/app/node_modules/rx/dist/rx.js:1772:14)
at InnerObserver.o.onError (/app/node_modules/rx/dist/rx.js:1999:22)
at InnerObserver.tryCatcher (/app/node_modules/rx/dist/rx.js:63:31)
at AutoDetachObserverPrototype.error (/app/node_modules/rx/dist/rx.js:5891:52)
at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onError (/app/node_modules/rx/dist/rx.js:1772:14)
at AutoDetachObserver.o.onError (/app/node_modules/rx/dist/rx.js:1999:22)
at AutoDetachObserver.o.onError (/app/node_modules/rx/dist/rx.js:1999:22)
at /app/node_modules/rx/dist/rx.js:1904:72
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! freecodecamp@0.1.0 only-once: `npm run prelint-js && echo '/****/' && echo 'Seeding Database' && echo '/****/' && node seed/index.js && echo '/****/' && echo 'Seeding Completed' && echo '/****/'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the freecodecamp@0.1.0 only-once 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! /root/.npm/_logs/2018-05-29T00_05_10_316Z-debug.log
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Error (The seeding operation failed) when running Add ...
This cmdlet adds a copy of the mailbox database without invoking automatic seeding. In this example, a copy of mailbox database DB01 is...
Read more >error when seeding data into a database in laravel 8
am getting this error when seeding data into my database. apparently the I have 2 models bookings and bookingstatus model.the bookingstatus ...
Read more >Database seed error - Laracasts
Hi, this is the first time that I use Laravel 5 and I need your help. After I create the database with "migrate",...
Read more >Fortify Seeding error - Micro Focus Community
Seeding failed : Unable to seed all init seed bundles." What version of SSC? 22.1; Database - which one and what version?
Read more >Reseeding after 'Mailbox Database Copy Failed & Suspended'
During seeding, you might encounter an issue with the passive database and the seeding stops with the error “Mailbox Database Copy Failed or ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A hacky workaround for the moment is:
Edit home.js and comment out line 12 until 24.
You can this manually or if you have patch installed you could do this automatically by creating a file named
home.patch
with the following contents:And then run patch like so:
However you changed
home.js
, your next step is to run the seeding by either:docker-compose run --rm freecodecamp npm run only-once
npm run only-once
When seeding is done, restore home.js by doing
git checkout server/boot/home.js
and start freeCodecamp as you normally would, ie:docker-compose up
npm start
Contributions for a permanent fix are welcome!
Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh. Now I know what is broken, thank you for your investigation @ptsurbeleu!!
The models are imported from the app during seed to destroy/create blocks and challenges. This has a side-effect of spinning up the server, which in its current state, requires challenge info whilst bootstrapping.
I will see about patching this today