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

TypeError: Cannot read property 'toString' of null when running mongodb 4.2 #47

Open
m-weeks opened this issue Sep 29, 2020 · 7 comments

Comments

@m-weeks
Copy link

m-weeks commented Sep 29, 2020

Not sure if this is fixed in 0.7.0, as that version gives me another error (same as #46).

I am running version 0.6.2 in a docker container, which works fine when running mongodb 4.0 but not 4.2.

My dockerfile looks like the following:

FROM node:12-stretch

RUN apt-get install libkrb5-dev
RUN npm install run-rs@0.6.2 --unsafe-perm -g
CMD ["run-rs","--keep", "-q", "--version", "4.0.0", "--host", "mongo"]

And the output of my container is the following:

Downloading MongoDB 4.2.0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  109M    0     0  16.0M      0  0:00:06  0:00:06 --:--:-- 17.8M
Copied MongoDB 4.2.0 to '/usr/local/lib/node_modules/run-rs/4.2.0'
Skipping purge
Running '/usr/local/lib/node_modules/run-rs/4.2.0/mongod' [ 27017, 27018, 27019 ]
Restarting replica set...
/usr/local/lib/node_modules/run-rs/node_modules/mongodb-topology-manager/lib/server.js:101
            .toString()
             ^

TypeError: Cannot read property 'toString' of null
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/run-rs/node_modules/mongodb-topology-manager/lib/server.js:101:14)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:443:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:674:12)
@ptrk8
Copy link

ptrk8 commented Nov 20, 2020

@m-weeks I'm encountering the exact same issue as you. Just wondering if manage to resolve it?

Actually, I've resolved it. I think the error is related to this.

I took the advice below:

It looks like simply installing mongo should resolve this issue.

and installed mongodb 4.2.6 and used run-rs with the --mongod flag and it worked without any issues.

@vkarpov15
Copy link
Owner

I think this is a case where either the download failed or the process was unable to run. We should improve this error message.

@codedavinci
Copy link

codedavinci commented Nov 23, 2020

@vkarpov15 I tested it and the link to download has changed, I forked the project to debug it and I fixed. I could send a pull a request. Btw I've been having the same issue with the version 4.4.1

@m-weeks
Copy link
Author

m-weeks commented Dec 2, 2020

Now that #46 is fixed I figured I would try this with v0.7.3, but the issue still exists

@vorticalbox
Copy link

vorticalbox commented Jun 25, 2021

@m-weeks I'm encountering the exact same issue as you. Just wondering if manage to resolve it?

Actually, I've resolved it. I think the error is related to this.

I took the advice below:

It looks like simply installing mongo should resolve this issue.

and installed mongodb 4.2.6 and used run-rs with the --mongod flag and it worked without any issues.

I wouldn't say this is a fix, I don't want to install mongdb to my machine which is why i am using run-rs in the first place.

it fails to start on versions 4.2 or higher, i stopped at 4.1.1

@tayurus
Copy link

tayurus commented Aug 29, 2022

npm cache clean --force helped me

@joeskeen
Copy link

it fails to start on versions 4.2 or higher, i stopped at 4.1.1

Thanks @vorticalbox I was able to change my run-rs to target 4.1.1 to workaround the issue!

SabreCat pushed a commit to HabitRPG/habitica that referenced this issue Dec 6, 2023
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

7 participants