Open RobertSandiford opened 3 years ago
@RobertSandiford Try running with this env var: APOS_MONGODB_URI=mongodb://localhost/<db name>?authSource=admin
(replace <db name>
)
I started with this boilerplate a week ago and didn't have any problem connecting to local db but when it came time to connect to my prod db I had a problem like this and had to add ?authSource=admin
to my connection string.
This problem might be related to mongodb server configuration or version.
Nope that hasn't fixed it. My string works in MongoDB Compass but no change in apostrophe.
https://github.com/apostrophecms/a3-boilerplate
The boilerplate here also doesn't have an .env or any instructions on making an .env or entering database details. So this is still quite weird to me.
Ah you mean setting a shell env variable (or whatever it's called). I guess it will just hook up .dotenv.
Thanks
Here is an updated repo with .env, dotenv, cross-env (needed to run on windows), and updated readme, if apos want to use it.
I get missing styles after build.
I guess this is just not being maintained, sadly.
:3000/apos-frontend/…module-bundle.js:85 Uncaught Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): Error: PostCSS plugin autoprefixer requires PostCSS 8. Migration guide for end-users: https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users at Processor.normalize (C:\Users\Robert\Desktop\apostrophe\node_modules\postcss\lib\processor.js:153:15) at new Processor (C:\Users\Robert\Desktop\apostrophe\node_modules\postcss\lib\processor.js:56:25) at postcss (C:\Users\Robert\Desktop\apostrophe\node_modules\postcss\lib\postcss.js:55:10) at Object.loader (C:\Users\Robert\Desktop\apostrophe\node_modules\postcss-loader\dist\index.js:87:20) at processResult (C:\Users\Robert\Desktop\apostrophe\node_modules\webpack\lib\NormalModule.js:701:19) at C:\Users\Robert\Desktop\apostrophe\node_modules\webpack\lib\NormalModule.js:807:5 at C:\Users\Robert\Desktop\apostrophe\node_modules\loader-runner\lib\LoaderRunner.js:399:11 at C:\Users\Robert\Desktop\apostrophe\node_modules\loader-runner\lib\LoaderRunner.js:251:18 at context.callback (C:\Users\Robert\Desktop\apostrophe\node_modules\loader-runner\lib\LoaderRunner.js:124:13) at Object.loader (C:\Users\Robert\Desktop\apostrophe\node_modules\postcss-loader\dist\index.js:96:7) at Object../modules/asset/ui/src/index.scss (http://localhost:3000/apos-frontend/default/apos-module-bundle.js:85:7) at webpack_require (http://localhost:3000/apos-frontend/default/apos-module-bundle.js:109:41) at eval (webpack-internal:///./apos-build/default/src-import.js:5:123) at Object../apos-build/default/src-import.js (http://localhost:3000/apos-frontend/default/apos-module-bundle.js:20:1) at webpack_require (http://localhost:3000/apos-frontend/default/apos-module-bundle.js:109:41) at http://localhost:3000/apos-frontend/default/apos-module-bundle.js:161:37 at http://localhost:3000/apos-frontend/default/apos-module-bundle.js:163:12
@RobertSandiford Are you using Yarn package manager or npm?
If it's Yarn, try npm instead. I had a similar problem.
Here is an updated repo with .env, dotenv, cross-env (needed to run on windows), and updated readme, if apos want to use it.
@RobertSandiford I would go for a PR! Having this stuff set up in the boilerplate already is definitely useful.
Well isn't that funny. Delete node_modules and reinstalled with npm and it works! Still get the error, but the styles are there.
Thank you!
Actually maybe no error - just had preserve log on
@abea this is a good reminder that not everyone is in an environment where even local mongodb does not require credentials, would you mind considering this a ticket to document APOS_MONGODB_URI?
(Or rather, to mention it at the necessary steps early enough that developers don't stub their toes before they get a chance to really try Apostrophe)
I'll create a ticket in our internal system to follow up.
Old issue, but I ran into the same problem. In mycase, I was standing up my mongodb instance in a container defined in a docker-compose.yml
file with the default user/password set as follows:
- MONGO_INITDB_ROOT_USERNAME=rootuser
- MONGO_INITDB_ROOT_PASSWORD=rootpassword
From there, I passed the connection string as an env variable to the create script:
APOS_MONGODB_URI=mongodb://rootuser:rootpassword@127.0.0.1:27017/?authMechanism=DEFAULT apos create my-blog
And the create script ran successfully without errors.
Another thing I'd like to propose is that since this has a dependency on node and mongodb, the create script should be able to run on an existing non-empty folder. In my case, I stood up mongodb with docker compose and am managing my node installation with nvm. I put a docker-compose.yml
file in my project root, along with a .nvm
file to declare my node version. Was surprised to find the create script would fail immediately when I had these defined in an existing folder.
While I was able to create these files and stand up the mongodb service outside of my project root and move them into the folder afterwords, that feels counter-intuitive.
I'm really baffled with the setup of this app.
I followed the instructions here, using the CLI method. https://v3.docs.apostrophecms.org/guide/setting-up.html#creating-a-project
Different to the guide, it installed packages itself, and seemingly create an admin user without prompting.
Then when I
yarn dev
I get "MongoError: command find requires authentication"And it occurs to me that there was no mention anywhere of putting in database details.
I'm figuring that these docs are badly out of date. What's the state of affairs? Is the project still going?
Version of Node.js: v14.8.1
Version of MongDB: v4.4.3
Server Operating System: Win 10