You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to configure Remark42 to store avatars in MongoDB, but there are two problems:
The mongodb+srv:// URIs are not recognized by NewStore:
funcNewStore(uristring) (Store, error) {
....
casestrings.HasPrefix(uri, "mongodb://"), strings.HasPrefix(uri, "mongodb+srv://"): // <--- this is missing....
}
just removing the +srv part results in connection failure:
2022/10/02 21:33:31.852 [PANIC] {cmd/server.go:315 cmd.(*ServerCommand).Execute} failed to setup application, failed to make avatar store: failed to connect to mongo server: server selection error: context deadline exceeded, current topology: { Type: Unknown, Servers: [{ Addr: cluster0.abcdef.mongodb.net:27017, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp: lookup cluster0.abcdef.mongodb.net: no such host }, ] }
The context timeout of just 1 second is too short:
2022/10/02 22:17:18.812 [PANIC] {cmd/server.go:315 cmd.(*ServerCommand).Execute} failed to setup application, failed to make avatar store: failed to connect to mongo server: timed out while checking out a connection from connection pool: context deadline exceeded; maxPoolSize: 100, connections in use by cursors: 0, connections in use by transactions: 0, connections in use by other operations: 1
I modified the code on the fly by setting ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second) and it works.
Ideally the timeout should be configurable, MongoDB documentation reports a default timeout of 30 seconds.
Thanks
The text was updated successfully, but these errors were encountered:
Hello, I'm trying to configure Remark42 to store avatars in MongoDB, but there are two problems:
mongodb+srv://
URIs are not recognized byNewStore
:just removing the
+srv
part results in connection failure:resulting in
I modified the code on the fly by setting
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
and it works.Ideally the timeout should be configurable, MongoDB documentation reports a default timeout of 30 seconds.
Thanks
The text was updated successfully, but these errors were encountered: