Fails User Preferences Check, Passes User Management

I’m Passing all the unit tests but i keep getting this error


All the unit tests for the User Prefs and User Management Pass

Like the FAQ says, i’ve already changed the secret key, checked the number of records in the DB and extracted a new copy of the Unit Tests from the zip.

Hi @kevinwochan,

Could you share the error that you are getting in the shell, when the integration tests page is loading?

Kanika

Hi @Kanika,

I’m not sure what the best way to share the output with you so sorry for the formatting

2019-04-26 01:26:55.414 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:2, serverValue:15938}] to mflix-shard-00-01-6ffbh.mongodb.net:27017
2019-04-26 01:26:55.414 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:3, serverValue:13320}] to mflix-shard-00-00-6ffbh.mongodb.net:27017
2019-04-26 01:26:55.414 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:11395}] to mflix-shard-00-02-6ffbh.mongodb.net:27017
2019-04-26 01:26:55.830 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address:27017=mflix-shard-00-00-6ffbh.mongodb.net, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 0, 9]}, minWireVersion=0, maxWireVersion=7, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=406932174, setName=‘mflix-shard-0’, canonicalAddress:27017=mflix-shard-00-00-6ffbh.mongodb.net, hosts=[mflix-shard-00-01-6ffbh.mongodb.net:27017, mflix-shard-00-00-6ffbh.mongodb.net:27017, mflix-shard-00-02-6ffbh.mongodb.net:27017], passives=, arbiters=, primary=‘mflix-shard-00-01-6ffbh.mongodb.net:27017’, tagSet=TagSet{[Tag{name=‘region’, value=‘US_EAST_1’}, Tag{name=‘provider’, value=‘AWS’}, Tag{name=‘nodeType’, value=‘ELECTABLE’}]}, electionId=null, setVersion=1, lastWriteDate=Fri Apr 26 01:26:50 AEST 2019, lastUpdateTimeNanos=83661186633224}
2019-04-26 01:26:55.832 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address:27017=mflix-shard-00-01-6ffbh.mongodb.net, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 0, 9]}, minWireVersion=0, maxWireVersion=7, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=413842681, setName=‘mflix-shard-0’, canonicalAddress:27017=mflix-shard-00-01-6ffbh.mongodb.net, hosts=[mflix-shard-00-01-6ffbh.mongodb.net:27017, mflix-shard-00-00-6ffbh.mongodb.net:27017, mflix-shard-00-02-6ffbh.mongodb.net:27017], passives=, arbiters=, primary=‘mflix-shard-00-01-6ffbh.mongodb.net:27017’, tagSet=TagSet{[Tag{name=‘region’, value=‘US_EAST_1’}, Tag{name=‘provider’, value=‘AWS’}, Tag{name=‘nodeType’, value=‘ELECTABLE’}]}, electionId=7fffffff0000000000000002, setVersion=1, lastWriteDate=Fri Apr 26 01:26:50 AEST 2019, lastUpdateTimeNanos=83661190910807}
2019-04-26 01:26:55.834 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.cluster : Setting max election id to 7fffffff0000000000000002 from replica set primary mflix-shard-00-01-6ffbh.mongodb.net:27017
2019-04-26 01:26:55.835 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.cluster : Setting max set version to 1 from replica set primary mflix-shard-00-01-6ffbh.mongodb.net:27017
2019-04-26 01:26:55.835 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.cluster : Discovered replica set primary mflix-shard-00-01-6ffbh.mongodb.net:27017
2019-04-26 01:26:56.643 INFO 6681 — [ngodb.net:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address:27017=mflix-shard-00-02-6ffbh.mongodb.net, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 0, 9]}, minWireVersion=0, maxWireVersion=7, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=1223476010, setName=‘mflix-shard-0’, canonicalAddress:27017=mflix-shard-00-02-6ffbh.mongodb.net, hosts=[mflix-shard-00-01-6ffbh.mongodb.net:27017, mflix-shard-00-00-6ffbh.mongodb.net:27017, mflix-shard-00-02-6ffbh.mongodb.net:27017], passives=, arbiters=, primary=‘mflix-shard-00-01-6ffbh.mongodb.net:27017’, tagSet=TagSet{[Tag{name=‘region’, value=‘US_EAST_1’}, Tag{name=‘provider’, value=‘AWS’}, Tag{name=‘nodeType’, value=‘ELECTABLE’}]}, electionId=null, setVersion=1, lastWriteDate=Fri Apr 26 01:26:50 AEST 2019, lastUpdateTimeNanos=83662001190331}
2019-04-26 01:27:04.529 INFO 6681 — [nio-5000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet ‘dispatcherServlet’
2019-04-26 01:27:04.529 INFO 6681 — [nio-5000-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet ‘dispatcherServlet’: initialization started
2019-04-26 01:27:04.552 INFO 6681 — [nio-5000-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet ‘dispatcherServlet’: initialization completed in 23 ms

Hi @kevinwochan,

Please try doing hard-refresh or use incognito mode. It might be possible that it’s cached.

If it still does not resolve the issue then let me know.

Kanika

com.mongodb.MongoWriteException: E11000 duplicate key error collection: 5cdb9ee079358ec2b0773f99_mflix.sessions index: user_id_1 dup key: { : “yfm0xwx3v@sukbt.br4” }
at com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:967) ~[mongodb-driver-sync-3.9.1.jar:na]
at com.mongodb.client.internal.MongoCollectionImpl.executeUpdate(MongoCollectionImpl.java:951) ~[mongodb-driver-sync-3.9.1.jar:na]

Hi @Marina_37816,

Please re-check your code for updateUserPreferences function again. Make sure to add a filter for the Updates.

If that is not helpful, please let me know. I will help you debug more.

Kanika

Hi, did you manage to resolve this problem? I’m seeing the exact same problem. Unit tests for User Preferences are all OK, but integration tests are failing with

> 2019-05-21 14:25:55.045 ERROR 8324 — [nio-5000-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.mongodb.MongoWriteException: E11000 duplicate key error collection: mflix.sessions index: user_id_1 dup key: { : “oa0u1to7x@6hn39.f6m” }] with root cause
*> *
> com.mongodb.MongoWriteException: E11000 duplicate key error collection: mflix.sessions index: user_id_1 dup key: { : “oa0u1to7x@6hn39.f6m” }
> at com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:967) ~[mongodb-driver-sync-3.9.1.jar:na]
> at com.mongodb.client.internal.MongoCollectionImpl.executeInsertOne(MongoCollectionImpl.java:494) ~[mongodb-driver-sync-3.9.1.jar:na]
> at com.mongodb.client.internal.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:478) ~[mongodb-driver-sync-3.9.1.jar:na]

I tried the suggestions in previous posts.

Found my problem. I didn’t have the ‘upsert’ option set in createUserSession(…). Changed it to the following …


UpdateOptions options = new UpdateOptions().upsert(true);
sessionsCollection.updateOne(updateFilter, setUpdate, options);

… and it works fine.

2 Likes