Getting a 500 internal server error when trying to async open a realm

I’ve been using realm/sync to develop an iOS app. Everything has been going fairly smoothly. Today I made some schema changes, and enabled dev mode to push them. Now all of a sudden whenever I try and open a realm with my code, I just get a 500 internal server error with no helpful information.

Just this error:

Sync: Connection[1]: Websocket: Expected HTTP response 101 Switching Protocols, but received:

HTTP/1.1 500 Internal Server Error
cache-control: no-cache, no-store, must-revalidate
connection: close
content-length: 71
content-type: application/json
date: Wed, 03 Nov 2021 19:37:51 GMT
server: envoy
vary: Origin
x-envoy-max-retries: 0
x-frame-options: DENY

I’ve tried disabling sync, deleting the app, etc. Nothing seems to fix it. Any ideas?

Hi Griffin, welcome to the MongoDB community!

I would try uninstalling the app from and reinstalling it to your testing environment. During the development phase, it often makes sense to do that since it fully resets your client state.

Development mode doesn’t always play nicely with the migration and schema needs of clients since it’s designed for use only in pre-production apps. It makes a lot of sense to leave it on for the entire duration of time where you’re tweaking your schema, but once you get to a point where you need permanence for objects on the client (most commonly during production rollout, but also potentially during QA phases of development) you should probably turn it off and handle future changes through manual tweaks to the JSON schema.

I have the same issue and I have tried everything that is mentioned above.
Yesterday I did the same thing and it was all good.
Is there anything else that can solve the problem?

Hi Nathan, thank you!

I have tried uninstalling and re-installing the app from my devices. I also tried making an entirely new database with the same results. Finally, I tried running the task-tracker-swiftui sample and that is ALSO running into the same 500 error. (It was working just fine yesterday.) I’m so confused. It feels like my MongoDB account has been blacklisted! Is there anywhere else I can look for logs to see what might be causing all of this?

Update: I’m not sure what changed, but it seems things are working again. Was there a hidden problem with Realm/MongoDB? If this was something I did, I’d love to know what it was that caused every Realm app across multiple MongoDB databases to stop working!

Hi @Griffin_Meyer,
Thanks for the update!
Things are working for me too now.

Odd. Hopefully Nathan/MongoDB can provide some clarity on what happened!

I’m experiencing this now. Checking the Logs in realm UI I find sync error

failed to construct service instance with name “mongodb-atlas”: only [uri, clusterId, clusterName, clusterType, clusterSize, clusterUpdated, dbUsername, dbPassword, lastUpdated, wireProtocolEnabled, regionName, groupName, orgName, namespacePreimageConfigs, readPreference, readPreferenceTagSets, sync, sync_query, certificate] are allowed config options

Please give us a clear answer, I have my bootstraped product completely made on this platform, I have read the documentation satisfactorily, and now my application has simply stopped and I can’t serve my customers, I’m wasting the whole holiday season burning my head trying to solve this. I’m really enjoying the mongodb experience and it’s really pleasing me, I hope to contribute financially through the services, but we need a resolution that will guide us to correct this unknown error.

Hi @Informativos_Agricola , this is a pretty old post with a few different threads. If you are running into an issue, can you please provide a bit more information about what is happening and your application id?

Also, a reminder that you should go through the support portal (MongoDB Support Hub | MongoDB) to get assistance for production issues.