Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: ERROR [MongooseModule] Unable to connect to the database, getting backend to start #22

Open
mykelbengineer opened this issue Sep 10, 2023 · 3 comments

Comments

@mykelbengineer
Copy link

When I start the backend by

cd backend

npm run start:dev

I get the following output

[Nest] 15698  - 09/09/2023, 10:13:24 PM     LOG [NestFactory] Starting Nest application...
[Nest] 15698  - 09/09/2023, 10:13:24 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (1)...
[Nest] 15698  - 09/09/2023, 10:13:24 PM     LOG [InstanceLoader] MongooseModule dependencies initialized +1ms
[Nest] 15698  - 09/09/2023, 10:13:24 PM     LOG [InstanceLoader] PassportModule dependencies initialized +0ms
[Nest] 15698  - 09/09/2023, 10:13:24 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
[Nest] 15698  - 09/09/2023, 10:13:24 PM     LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 15698  - 09/09/2023, 10:13:24 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 15698  - 09/09/2023, 10:13:24 PM     LOG [InstanceLoader] JwtModule dependencies initialized +0ms
[Nest] 15698  - 09/09/2023, 10:13:27 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (2)...
[Nest] 15698  - 09/09/2023, 10:13:30 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (3)...
[Nest] 15698  - 09/09/2023, 10:13:33 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (4)...
[Nest] 15698  - 09/09/2023, 10:13:36 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (5)...
[Nest] 15698  - 09/09/2023, 10:13:39 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (6)...
[Nest] 15698  - 09/09/2023, 10:13:42 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (7)...
[Nest] 15698  - 09/09/2023, 10:13:45 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (8)...
[Nest] 15698  - 09/09/2023, 10:13:48 PM   ERROR [MongooseModule] Unable to connect to the database. Retrying (9)...
[Nest] 15698  - 09/09/2023, 10:13:48 PM   ERROR [ExceptionHandler] The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.

Am I missing a node module or didn't follow an instruction?

@AmadeusSlabu
Copy link

AmadeusSlabu commented Sep 10, 2023

Okay, after realizing you are not the author of the code, but instead just forked it, I tried to replicate the issue. Simple answer is that they did not provide the .env.example files therefore without the lacking env files and the examples you didn't create a .env in backend folder with the specified values that are being used.

@mykelbengineer
Copy link
Author

Right! I’m just trying to review the code and without much assumption, I was hoping it was something as easy or simple as you have pointed out.

Hopefully they can add a sample env. Thanks for your comments, they are very insightful. Hadn’t thought about that

@Seiyaroo
Copy link
Contributor

@mykelbengineer thank you for putting eyes on this! @AmadeusMoon as well!

So I believe we have things at least potentially sorted on this front. We will get the .env.example file up shortly! Thank you both for taking the time to add issues and bring things forward to us, it's greatly appreciated!

We worked this morning on getting registration fixed and believe we found a solution. Had some CORS issues, but those seem to be solved with our latest release :)

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

No branches or pull requests

3 participants