I just set up my Realm app for deployment via GitHub (cool!) but when I tried it just now I got failed to import app: cannot link cluster for Atlas service via source control
I had already successfully used realm-cli
to configure the app (including linking cluster) and everything worked fine. The commit I am pushing has nothing to do with Atlas, it’s just a file in the hosting dir.
Hi @Ted_Hayes, are you able to share the repo so that I can try it out?
I can’t really share the repo unfortunately, but it was just exported using realm-cli from a basic project I had started. I hadn’t even changed or configured anything.
I thought perhaps it could have to do with the Export for Source Control limitations, but I’m using realm-cli
beta and that doesn’t offer that flag (perhaps they just made it compliant by default?)
So I inspected data_sources/mongodb-atlas/config.json
:
"name": "mongodb-atlas",
"type": "mongodb-atlas",
"config": {
"clusterName": "Cluster0",
"readPreference": "primary",
"wireProtocolEnabled": false
},
"version": 1
}
This seems compliant except for the name
field, so I tried taking that out but still got the same error.
I was able to recreate the error.
Firstly, you don’t need to flag the export as for source control with the new CLI.
I was able to fix the issue by removing the config.clusterName
attribute and leaving realm_config.json
unchanged (that part of the documentation is out of date - you shouldn’t edit that file after it’s been exported).
Aha, I got it to work by removing "clusterName": "Cluster0"
from mongodb-atlas/config.json
. Is that a bug on the Realm end, then?
Thank you so much!!!
Glad to hear that the workaround works. The engineering team is working on the fix as we type.
1 Like