Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Build Error while using MongoDB #53

Open
AvinsPvt opened this issue Aug 4, 2021 · 1 comment
Open

Build Error while using MongoDB #53

AvinsPvt opened this issue Aug 4, 2021 · 1 comment

Comments

@AvinsPvt
Copy link

AvinsPvt commented Aug 4, 2021

yarn create v1.22.10
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Installed "create-strapi-starter@3.6.5" with binaries:
- create-strapi-starter
[#################################################################################################################################################] 162/162?? Choose your installation type Custom (manual settings)
? Choose your default database client mongo
? Database name: irenehom
? Host: 127.0.0.1
? +srv connection: false
? Port (It will be ignored if you enable +srv): 27017
? Username:
? Password:
? Authentication database (Maybe "admin" or blank):
? Enable SSL connection: No

Creating a project with custom database options.
Creating a new Strapi application at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend.
Creating files.
Installing strapi/strapi-template-corporate template.
Dependencies installed successfully.

Your application was created at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend.

Available commands in your project:

yarn develop
Start Strapi in watch mode.

yarn start
Start Strapi without watch mode.

yarn build
Build Strapi admin panel.

yarn strapi
Display all available commands.

You can start by doing:

cd /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend
yarn develop

Creating Strapi starter frontend at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/frontend.
Installing strapi/strapi-starter-next-corporate starter
Dependencies installed successfully.
Dependencies installed successfully.
Starting the app
yarn run v1.22.10
$ cross-env FORCE_COLOR=1 npm-run-all -l -p develop:*
$ yarn --cwd backend develop
$ wait-on http://localhost:1337/admin && yarn --cwd frontend develop
$ strapi develop
[develop:backend ] Building your admin UI with development configuration ...
[develop:backend ] ℹ Compiling Webpack
[develop:backend ] (node:70382) ExperimentalWarning: Package name self resolution is an experimental feature. This feature could change at any time
[develop:backend ] ✔ Webpack: Compiled successfully in 26.72s
[develop:backend ] Error: global validation failed: _id: Cast to ObjectId failed for value "1" at path "_id"
[develop:backend ] at ValidationError.inspect (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/error/validation.js:47:26)
[develop:backend ] at formatValue (internal/util/inspect.js:693:31)
[develop:backend ] at inspect (internal/util/inspect.js:264:10)
[develop:backend ] at formatWithOptions (internal/util/inspect.js:1865:40)
[develop:backend ] at Object.Console. (internal/console/constructor.js:281:10)
[develop:backend ] at Object.log (internal/console/constructor.js:291:61)
[develop:backend ] at createEntry (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/config/functions/bootstrap.js:93:13)
[develop:backend ] at runMicrotasks ()
[develop:backend ] at processTicksAndRejections (internal/process/task_queues.js:97:5) {
[develop:backend ] errors: {
[develop:backend ] _id: CastError: Cast to ObjectId failed for value "1" at path "_id"
[develop:backend ] at ObjectId.cast (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/schema/objectid.js:269:11)
[develop:backend ] at ObjectId.SchemaType.applySetters (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/schematype.js:1075:12)
[develop:backend ] at model.$set (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:1250:20)
[develop:backend ] at model._handleIndex (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:1019:14)
[develop:backend ] at model.$set (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:960:22)
[develop:backend ] at model.Document (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:150:12)
[develop:backend ] at model.Model (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:106:12)
[develop:backend ] at new model (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:4686:15)
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:3052:22
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:3088:7
[develop:backend ] at Array.forEach ()
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:3087:15
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5
[develop:backend ] at new Promise ()
[develop:backend ] at promiseOrCallback (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10)
[develop:backend ] at Function.create (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:3022:10) {
[develop:backend ] stringValue: '"1"',
[develop:backend ] messageFormat: undefined,
[develop:backend ] kind: 'ObjectId',
[develop:backend ] value: 1,
[develop:backend ] path: '_id',
[develop:backend ] reason: Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
[develop:backend ] at new ObjectID (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/bson/lib/bson/objectid.js:59:11)
[develop:backend ] at castObjectId (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/cast/objectid.js:25:12)
[develop:backend ] at ObjectId.cast (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/schema/objectid.js:267:12)
[develop:backend ] at ObjectId.SchemaType.applySetters (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/schematype.js:1075:12)
[develop:backend ] at model.$set (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:1250:20)
[develop:backend ] at model._handleIndex (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:1019:14)
[develop:backend ] at model.$set (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:960:22)
[develop:backend ] at model.Document (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/document.js:150:12)
[develop:backend ] at model.Model (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:106:12)
[develop:backend ] at new model (/Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:4686:15)
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:3052:22
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:3088:7
[develop:backend ] at Array.forEach ()
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/model.js:3087:15
[develop:backend ] at /Users/avinleo/Documents/WorkRepos/strapi/irenehom/backend/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5
[develop:backend ] at new Promise ()
[develop:backend ] }
[develop:backend ] },
[develop:backend ] _message: 'global validation failed'
[develop:backend ] }

@beazergood
Copy link

beazergood commented Aug 17, 2021

@AvinsPvt I have just encountered the same issue when trying to hook up to mongo, did you find a solution? Looks like the ids in the data docs isn't in the correct format for mongoose. I would like to use the starter settings in my project to get me going so I am reluctant to remove them all and start from scratch.

edit: looks like just building the pages out again isn't too bad after all as the built-in components are still available.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants