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

not authorized on admin to execute command { create: "socket.io", capped: true, size: 5242880 } #13

Open
maciejso opened this issue May 16, 2019 · 2 comments

Comments

@maciejso
Copy link

Have been working on development on NodeBB for a while. It works fine with both local db and non-cluster Mongodb instances. However with a cluster on Atlas I am getting the following error:

not authorized on admin to execute command { create: "socket.io", capped: true, size: 5242880 } {"name":"MongoError","ok":0,"errmsg":"not authorized on admin to execute command { create: \"socket.io\", capped: true, size: 5242880 }","code":8000,"codeName":"AtlasError"}

Have been experimenting with set of different roles. Here, the user is assigned the following roles:

dbAdmin@somedbname
dbAdminAnyDatabase@admin
readWriteAnyDatabase@admin
enableSharding@admin

The database is hosted on Mongodb Atlas cluster.

{
    "url": "http://localhost:4567",
    "secret": "dc0b3fff-4312-1234-4321-e5a327824225",
    "database": "mongo",
    "port": "4567",
    "mongo": {
        "host": "cluster0-shard-00-00-z1243.mongodb.net,cluster0-shard-00-01-z1234.mongodb.net,cluster0-shard-00-02-z1234.mongodb.net",
        "port": "27017,27017,27017",
        "username": "dbUser",
        "password": "1234123412341234",
        "database": "somedbname",
        "uri": "mongodb+srv://dbUser:[email protected]/somedbname?replicaSet=Cluster0-00-01"
    }
}

MongoDb npm package version: 3.2.3

MongoDb version on Atlas: 4.0.8

The error occurs when running the code in VSCode locally on dev machine with db connection string pointing at MongoDb Atlas.

I can successfully connect and work with a local instance of mongodb.
The issue occurs only when connecting to Mongodb on Atlas.

Have also requested support directly from NodeBB community but did not get much from them.

Official Mongodb docs on what a connection to replicaset should look like.

enter image description here

@ghost
Copy link

ghost commented Jul 28, 2019

same problem here. Do you have some insight ?

@ghost
Copy link

ghost commented Jul 30, 2019

The problem lies in mubsub package. Using the v2 connection string worked for me. @maciejso

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

1 participant