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

[Bug?] [Mongoose/Mocha] Not connecting to database #10

Closed
piotrryczek opened this issue May 14, 2020 · 2 comments
Closed

[Bug?] [Mongoose/Mocha] Not connecting to database #10

piotrryczek opened this issue May 14, 2020 · 2 comments

Comments

@piotrryczek
Copy link

piotrryczek commented May 14, 2020

Hello,
I've spent couple (4-5) hours trying to make it works but it looks like it is something above me.

Error:
UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

Getting error for any settings configuration.

Here is repo:
https://github.com/piotrryczek/test-actions

Actions:
https://github.com/piotrryczek/test-actions/actions

Workflow:
https://github.com/piotrryczek/test-actions/blob/master/.github/workflows/main.yml

Here is sample test:
https://github.com/piotrryczek/test-actions/blob/master/src/models/___tests__/sample.test.ts

As you see I tried both via app and via mongoose standalone connection.
Env is correctly being injected.

Before also trying with Jest.
Locally tests are working correctly.
It is definetly problem with mongoose connection to mongo database.

Thank you in advance!

@piotrryczek piotrryczek changed the title [Mongoose/Mocha] Not connecting to database [Bug?] [Mongoose/Mocha] Not connecting to database May 14, 2020
@piotrryczek
Copy link
Author

Didn't set a replica in mongoose connection settings...

@marcuspoehls
Copy link
Member

@piotrryczek Hey Piotr, good to hear you already found the issue!

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

2 participants