10gen / realm-cli Goto Github PK
View Code? Open in Web Editor NEWMongoDB Realm CLI
License: Apache License 2.0
MongoDB Realm CLI
License: Apache License 2.0
Hello!
Looks like install.js
checks the environment for 64 bit architecture (understandably) but doesn't allow "arm64" (like the new Apple M1). I get
Realm CLI installation failed: Error: Only Mac 64 bits supported.
Changing line 30 like this...
} else if (platform === 'darwin' || platform === 'freebsd') {
- if (process.arch === 'x64') {
+ if (process.arch === 'x64' || process.arch === 'arm64') {
downloadURL = cli ? macdownloadURL : macTranspilerdownloadURL;
lets me install realm-cli
with npm link
.
Probably more to it than that, just figured I'd leave a note in case others came upon the issue
When realm_config.json file exists in the root of a realm project realm-cli push -y --project=PROJECT_ID
does not create a new app like stated in this page https://www.mongodb.com/docs/realm/manage-apps/deploy/automated/sdlc/#std-label-sdlc-create-app. Instead of creating an app, the cli updates the one that is configured in realm_config.js.
If I delete these keys from realm_config.json
"app_id": "test-ehitv",
"name": "test",
and then run realm-cli push -y --project=PROJECT_ID
it asks me to input the app name
If I type a name and hit enter, I can finally see a new app in mongodb realm.
My suggestion is to add a new flag called --name in this command. If this flag is passed, then the cli will create or update an app. I thought that --remote would do this, but it only updates an existing app when giving the "app's id". This new flag could also set the app's id instead of generating a weird one.
Hello,
when I push app instance using realm-cli, it does now show ID of the deployed app. Last line in output looks like:
Successfully pushed app up:
I think app ID is supposed to be here, as I think it was in previous versions.
Realm-cli version: 2.2.0
OS: Debian GNU/Linux 9.13 (stretch)
There should be a way to prevent the spinner being displayed - e.g. this one:
realm-cli/internal/commands/push/command.go
Lines 497 to 498 in 92c0faa
I'm using realm-cli on CI where stdout is piped to the CI logs, resulting in hundreds of messages similar to "Deploying app changes..."
. Additionally, these messages ignore the -f json
flag, requiring me to manually clean up the command output to then parse it. It would be great if the spinner was disabled when --disable-colors
is set or alternatively, there should be a different option allowing users to get rid of it.
Hi guys,
Having troubles with external dependencies when they are installed from a local folder. I'm attempting to create Realm Functions with a common library that will be shared amongst all functions.
> cd functions
> npm install ../../../my-common-library
> tar -chf node_modules.tar node_modules // <-- Note the -h flag
> realm-cli import --include-dependencies
The above results in the following error;
Import dependencies
Please confirm the changes shown above: [y/n]: y
Creating draft for app...
Draft created successfully...
Importing app...
Deploying app...
Deploying app...
Deploying app...
Deploying app...
Deploying app...
Done.
failed to read file 'node_modules/my-common-library' in the archive: read /Users/ ... /my-realm-app/functions/node_modules/my-common-library: is a directory
The issue to me seems to be that the directory node_modules/my-common-library
is actually a symlink. The above error puts my app into a weird state where the function has been deployed but causes errors with subsequent import
attempts. The workaround for now has been to just delete the function in the Realm console and deploy. Is there a better way to handle this situation?
failed to diff app with currently deployed instance: error: must specify unique names when importing Functions; duplicate name: test_function
Although i'm unable to reproduce the following any more, just calling out that i have received this error at some point while attempting to perform the above. I'll raise another bug i am able to reproduce;
> realm-cli import --include-dependencies
Import dependencies
Please confirm the changes shown above: [y/n]: Creating draft for app...
Draft created successfully...
Importing app...
Deploying app...
Deploying app...
Deploying app...
Done.
transpiling dependencies started.
multiple errors in []*TranspileError
I'm using realm-cli 1.2.0 on MacOS Catalina 10.15.7
Hi, in my build pipeline I want to generate realm schemas based on mongo collection schemas.
I used the following command: realm-cli schemas datamodel -l javascript -o ./realm/schema.js
This works great except for one thing - my schema.js
file also contains the realm-cli message
We would very much like to be able to turn off verbose output, something like the "--no-verbose" flag.
Hi,
I have an application with
{
"app_id": "some-app-gkymj",
"config_version": 20210101,
"name": "some-app",
"location": "DE-FF",
"provider_region": "gcp-europe-west1",
"deployment_model": "LOCAL",
"environment": "testing"
}
but I'm not able to recreate it via push
, as e.g. the field provider_region is not queried.
Other locations are not selectable at all. Is this py purpose, or do I miss something here?
Specifically, I'm interested in selecting GCP Belgium (europe-west-1)
update
I tested a little further...
Deployed app is identical to proposed version, nothing to do
So it seems this field is completely ignored.
Does that mean that only the locations currently available are usable with realm-cli and that provider_region is also ignored?
npm i -g mongodb-realm-cli
fails on Ubuntu 22.10 on aarch64
Trying to script realm-cli push
and noticed that when there's a "push failed: stream timeout" error or output, it is not triggering an EXIT_FAILURE. It is outputting a "1" in stdout, but not triggering EXIT_FAILURE (but that might be just a catchall in nodejs).
Unable to pinpoint a way to reproduce as I'm currently trying to solve the issue with push failed: stream timeout. But I have to run the realm-cli push
manually in bash as opposed through node and child_process.spawn. spawn is not firing on error, but rather 'close' with a stdout of "1". Seems like there's an "echo 1" or "return 1" somewhere in the clients.Realm.Diff
internal function instead of exit 1
if you can forgive my bash syntax.
I have a CI/CD chain that uses npx mongodb-realm-cli, and it was working fine until 8 days ago when it broke with the error:
unknown flag: --app-id
I tried changing it to --app with no luck. I couldn't find the commit that might have caused this problem. What do I need to change to get the command to work? Thanks!
I've added an environment value to my project, like below:
In file environments/no-environment.json
:
{
"values": {
"value1": {
"property1": "property1Value",
"property2": "property2Value"
}
}
}
However, every time I run realm-cli push --remote="<my-realm-app-id>"
, it presents the following output:
The following reflects the proposed changes to your Realm app
--- environments/no-environment.json
+++ environments/no-environment.json
@@ -1,13 +1,7 @@
{
- "value1": [
- {
- "Key": "property1",
- "Value": "property1Value"
- },
- {
- "Key": "property2",
- "Value": "property2Value"
- }
- ]
+ "value": {
+ "property1": "property1Value",
+ "property2": "property2Value"
+ }
}
I think this is a bug?
Hello Everyone
trying to create new Realm App using realm-cli app create --remote
to clone existing app but i get this error
app create failed: error validating Service: "service_name": could not find secret “value_name”
it seems that the app creation with --remote should clone secrets first or i’m doing something wrong
here is my full command:
realm-cli app create --name my-app --remote app-id --local my-app --location DE-FF --deployment-model LOCAL --environment qa
I'm trying to run realm-cli push in a development app and I'm getting error 500.
I already tried to delete the app and create another one, I reinstalled node and realm-cli but nothing solves this problem in my development project, the same source does not give an error in the app with production enviremont.
Does anyone have any ideas?
actualling when running on m1, none of the commands works. all of them fails with same errror
downgrading to version 2.0.0 login works on version, but then the cli does not recoginize flag --template on pull operation ¯_(ツ)_/¯
running on mac m1
node version v16.16.0 (I also tryed other version with no success)
beto@badblood Dev % realm-cli login --api-key **** --private-api-key ******
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn /Users/beto/.nvm/versions/node/v16.16.0/lib/node_modules/mongodb-realm-cli/realm-cli ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /Users/beto/.nvm/versions/node/v16.16.0/lib/node_modules/mongodb-realm-cli/realm-cli',
path: '/Users/beto/.nvm/versions/node/v16.16.0/lib/node_modules/mongodb-realm-cli/realm-cli',
spawnargs: [
'login',
'--api-key',
'*****',
'--private-api-key',
'*****'
]
}
In our project we use mongodb-realm-cli
tool v.1.3.4 and realm schemas are not exported correctly. mongodb-realm-cli
is exported only database
and collection
fields without id
, relationships
, schema
fields, how it was before. And we can not switch to the newer version mongodb-realm-cli
soon. I assume that there are some changes in the Realm API.
This is export example:
schema.json
{ "database": "some-db", "collection": "some-collection" }
We use this command for export:
realm-cli export --app-id=${REALM_APP_ID} --output=realm-deploy/template-${TARGET} --as-template
And also I have just noticed we have problem with deploy command, after I run deploy command, it shows diff in which all schemas will be removed.
We use this command for deploy:
realm-cli import --app-id=${REALM_APP_ID} --path=realm-deploy/template-${TARGET} --strategy=replace
Few days ago thees commands works fine and we did not change anything..
Could you help with thees issues please?
Created a new Realms application, initialized an example function named test/create
using the example code located here, then pulled the remote using realm-cli. cd
ing into the application directory and then immediately running realm-cli push --remote="remote-id"
gives the error push failed: resource name can only contain ASCII letters, numbers, and underscores
. Re-configuring both the functions config JSON and function source to not be nested (moved to create.js
from test/create.js
within the functions
directory) succeeds - it seems like realm-cli isn't configured to handle nested functions when pushing.
Assuming the realm-cli is analogous to the MongoDb Atlas App Services Admin API, we should be able to create an "atlas" app via the realm-cli (as we can using the admin API).
However, the --product flag does not work with the app create command.
failed to load CLI profile: While parsing config: yaml: line 6: could not find expected ':'
Just got this error and it won't go anywhere I tried to uninstall the cli through npm and downgrade the version to 1.3 nothing works, it won't let me logout or do anything.
It happened when I run an Atlas function
Using the following versions:
CLI was successfully installed with npm i mongodb-realm-cli --location=global
.
As instructed by the MongoDB App Services UI, I ran realm-cli login --api-key <key> --private-api-key <private-key>
.
This yields the following output:
Expected behaviour: successful login with newly generated credentials.
I've noticed a huge package size on npm package of version 2.6.0, this make install the package take a long time. As you can see and check on the image, on the version 2.6.0 the package has 202 MB. I've just checked the version 2.6.0 on the node_modules folder and seems that the source code were packed as well.
On the version 2.5.0 it was: 10.8 MB.
This same problem already had happened before on the version 2.4.1.
Hi, I'm looking to use this CLI to automatically manage my Realm apps but I can't seem to get the command to run during testing.
When I run realm-cli
with any option (login
, --yes
, 12345
, ...) or even without an option, the command fails with this stacktrace:
This stacktrace is from a global install
$ npm i -g mongodb-realm-cli
$ realm-cli
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn C:\Users\Victor\AppData\Roaming\npm\node_modules\mongodb-realm-cli\realm-cli.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
This stacktrace is from a local install
$ npm i mongodb-realm-cli
$ npx realm-cli
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn C:\Users\Victor\Desktop\Code\...\node_modules\mongodb-realm-cli\realm-cli.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Why is this happening?
The sync/config.json
file is being ignored by realm-cli.
When I change anything in functions/
I will get the correct behaviour when using realm-cli push.
However, when I change said sync/config.json
file, all I get is:
Deployed app is identical to proposed version, nothing to do
In case I update via the Realm UI, it saves correctly and next time I deploy, it pushes an “old version” of the sync/config.json
file.
This not only happens on my local machine, but also in my GitHub Action. My changes in that file are just completely ignored and it keeps uploading the same version.
If profile is empty and --realm-url is not set on command line, get an error.
To reproduce:
15:40 ~/Code >realm-cli whoami
Currently logged in user: $KEY (********---****-xxxxxxxxxxxx)
15:41 ~/Code/ >realm-cli login --api-key ${KEY} --private-api-key ${SECRET} --realm-url https://realm.mongodb.com
Successfully logged in
15:41 ~/Code >realm-cli login --api-key ${KEY} --private-api-key ${SECRET}
Successfully logged in
15:42 ~/Code >realm-cli login --api-key ${KEY} --private-api-key ${SECRET} --profile new
login failed: Post "/api/admin/v3.0/auth/providers/mongodb-cloud/login": unsupported protocol scheme ""
Issue found and fixed, PR on the way.
When running realm-cli diff
i get:
failed to diff app with currently deployed instance: error: must specify unique names when importing CustomResolvers; duplicate name: displayName
I've configured it in the UI like this:
I don't see why CustomResolvers must have unique names when they have different parent types?
Hello!
Documentation of the --for-source-control
says:
If enabled, realm-cli exports the application configuration without any fields that conflict with deployment via GitHub source control, including fields like name, app_id, location, and deployment_model in the config.json file as well as the config.clusterName field in the config.json of any Atlas data sources linked to the application.
Link to docs
So I was expecting that config exported using --for-source-control
won't contain app_id, but actually produces configuration where the root config.json
includes app_id, location and all other fields listed in the documentation.
The exact command I've used: realm-cli export --app-id="<my app ID>" --for-source-control --output=export_dir
I have 2 custom resolvers which resolve owner user data for different parent types
it’s defined like this (the on_type
is different for another parent type)
{
"field_name": "ownerData",
"function_name": "resolveOwnerData",
"input_type_format": "",
"on_type": "Template",
"payload_type": "User",
"payload_type_format": "generated"
}
when I run realm-cli, it shows error
push failed: must specify unique names when importing CustomResolvers; duplicate name: ownerData
if I change one field_name to another different string, it can be pushed normally
Moreover, I tried to create a custom resolver in realm web UI, it can be created normally, both resolvers have the same field name
And then I export the app from the web UI, unzip it and try to push it again, it shows the same error as above
Hey i'm trying to remove pending users with an app parameter
realm-cli users delete --app xxxx-xxxx-xxxx --pending=true
it shows all the pending users but when selecting them and accepting to delete, the users are still there.
It does work with active users
I have a problem when I try to migrate realm application to a new project.
realm-cli apps init --name "test" --remote "XX"
Creates a new realm app which can be pushed to the new project but when pushed with realm-cli push
it pushes with the original name and not --name "test"
The ios.swift.todo
template is unavailable a newly created App Services app. To reproduce (as per the documentation):
Follow the procedure described in the Create an App with the App Services UI guide, and select the Create App from Template tab in the Create a new App step.
If you want to use the iOS with UIKit template app, select SwiftUI + Atlas Device Sync Starter in the list of template apps, but specify ios.swift.todo when you pull the client code using the
realm-cli.
Running the command realm-cli pull --remote <App ID> --template ios.swift.todo
instead results in an error:
pull failed: frontend template 'ios.swift.todo' is not compatible with this app
push failed: Error in functions:
- latlong: unknown: Unexpected character '�'. (642:69)
Push appears to only fail when attempting to upload a custom_resolver/*.json file whose resolver function calls the offending function.
realm-cli -v
1.3.1
To reproduce: export a Realm app that contains static hosting files:
realm-cli export --app-id=<app-id> --output=<output-dir> --include-hosting
Results: all the files in the hosting
subdirectory have permissions -rwxr-xr-x
.
Expected results: execute bits should not be set.
Notes: none of the other app files have the executable bits set.
Hi!
I have permissions for a type object and default rules. I've deployed these changes using web UI and it works great.
The problem is when I try to pull the changes made in the UI using realm-cli the fields "fields" and "additional_fields" are not included same if I add them in my code and then push using cli.
Here's what I have
{
"rules": {
"Project": [
{
"name": "readAuthorizedProject",
"applyWhen": {},
"write": {
"users": "%%user.id"
},
"fields": {
"sections": {
"write": true
}
},
"additional_fields": {
"read": true,
"write": false
}
}
]
},
"defaultRoles": [
{
"name": "read-write",
"applyWhen": {},
"read": true,
"write": true
}
]
}
And here's what I get if I pull
{
"rules": {
"Project": [
{
"name": "readAuthorizedProject",
"applyWhen": {},
"write": {
"users": "%%user.id"
}
}
]
},
"defaultRoles": [
{
"name": "read-write",
"applyWhen": {},
"read": true,
"write": true
}
]
}
I thought it might be the cli or app services simplifying my rules because they were unnecessarily complex but after testing my version is working as expected wheras the one with missing field is not what I want.
I’m trying to deploy a Realm App via the CLI and my app is tied to an M2 cluster and only has 5 database triggers in it. And here’s the error I’m getting when I try to deploy via the CLI:
error validating trigger: maximum database trigger count for cluster size=‘M0’ is 5
Can anyone from MongoDB and the App Services team help investigate? I can provide app ID to someone who can check this out?
As of two days ago (yesterday morning?), my CI/CD pipeline was fully functional and as of later yesterday and today it's broken with:
failed to import app: error: error validating Service: mongodb-atlas: only [uri, clusterId, clusterName, clusterType, clusterSize, clusterUpdated, dbUsername, dbPassword, lastUpdated, wireProtocolEnabled, regionName, groupName, orgName, namespacePreimageConfigs, readPreference, readPreferenceTagSets, sync, sync_query, connect_through_mesh] are allowed config options
The corresponding file contents were
{
"name": "mongodb-atlas",
"type": "mongodb-atlas",
"config": {
"readPreference": "primary",
"wireProtocolEnabled": true
},
"version": 1
}
Adding clusterName
into the config
section fixed the deployment.
Ultimately, where are the release notes and/or notification of breaking changes? How am I supposed to keep my stuff working smoothly when the contract changes?
Hello,
I've tried to push new app instance using realm-cli
and here is output I got:
? Do you wish to create a new app? Yes
? App Name
? App Location IE
? App Deployment Model GLOBAL
? App Environment
Determining changes
? Please confirm the changes shown above Yes
Creating draft
Pushing changes
Deploying draft
Deployment complete
Installed dependencies
Successfully pushed app up:
There is no changes shown after Determining changes
line. Although it probably does not make sense to list all the changes here when deploying new instance, absence of any output here looks weird, as actually there are whole app will be pushed.
Realm-cli version: 2.2.0
OS: Debian GNU/Linux 9.13 (stretch)
I am trying to install realm-cli via npm globally using the following command npm install -g mongodb-realm-cli
But this results in the following error.
npm install -g mongodb-realm-cli
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
C:\Users\XX\AppData\Roaming\npm\realm-cli -> C:\Users\XX\AppData\Roaming\npm\node_modules\mongodb-realm-cli\wrapper.js
> [email protected] install C:\Users\XX\AppData\Roaming\npm\node_modules\mongodb-realm-cli
> node install.js
Realm CLI installation failed: Error: Only Windows 64 bits supported.
at getdownloadURL (C:\Users\XX\AppData\Roaming\npm\node_modules\mongodb-realm-cli\install.js:32:13)
at Object.<anonymous> (C:\Users\XX\AppData\Roaming\npm\node_modules\mongodb-realm-cli\install.js:95:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XX\AppData\Roaming\npm-cache\_logs\2021-09-02T16_39_32_533Z-debug.log
I would like to clone a new realm from an existing realm app.
I expect realm-cli to clone everything from my existing realm app, but to create a unique realm_config.json
file locally
A new realm app is created from the existing realm app. However, the local realm_config.json
file for the new app is the exact same as the existing realm app's config file. In Realm UI, the new app has a unique name and ID.
> realm-cli apps create --remote [EXISTING_APP_ID] --name [NEW_APP_NAME]
> cd ./[NEW_APP_NAME] && realm-cli app describe
Observe that the returned app description contains the existing app ID instead of the new app ID.
Realm CLI Version: realm-cli version 2.0.0
When running our GitHub Action workflows, we ran into a cryptic failure using the mongo-realm-cli
v1.3.0. It is missing an environments
folder under dist
. Looking at both this repo and the Mongo Realm CLI docs, theres nothing about these environments being required when running with CLI. We simply fixed this issue by downgrading to 1.2.0. A changelog or documentation update would be nice when these things happen.
According to the docs here, using realm-cli pull
in realm-cli v2.x should exclude certain fields from the config such as name
, location
and deployment_model
from config.json
(now realm_config.json
), these fields are still present there.
The atlas data source config also includes the config.clusterName
field within its config.json
which it shouldnt according to the docs
After installing npm on ubuntu 20.04
~# npm --version 6.14.4
Here is the log :
`~# npm install -g mongodb-realm-cli
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
/usr/local/bin/realm-cli -> /usr/local/lib/node_modules/mongodb-realm-cli/wrapper.js
[email protected] install /usr/local/lib/node_modules/mongodb-realm-cli
node install.js
downloading "realm-cli" from "https://s3.amazonaws.com/realm-clis/realm_cli_rhel70_eac24f7b9b5bf9038f57b4cc658750ccc302d86a_21_09_29_13_29_04/linux-amd64/realm-cli"
failed to download Realm CLI: { Error: EACCES: permission denied, open '/usr/local/lib/node_modules/mongodb-realm-cli/realm-cli'
at Object.openSync (fs.js:443:3)
at Promise (/usr/local/lib/node_modules/mongodb-realm-cli/install.js:62:24)
at new Promise ()
at requstBinary (/usr/local/lib/node_modules/mongodb-realm-cli/install.js:56:10)
at Object. (/usr/local/lib/node_modules/mongodb-realm-cli/install.js:101:1)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/usr/local/lib/node_modules/mongodb-realm-cli/realm-cli' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-10-13T12_20_58_544Z-debug.log
`
Any idea to install this client ?
Thanks.
Looks like using version 2.3.3 using default login credentials as per Realm UI instructions gives error "login setup failed: unsupported login type, use one of [cloud, local] instead". I managed to circumvent this by specifying --auth-type flag however this option isn't even listed in the help files...
Hi,
It appears that the realm-cli does not work as expected for arm64.
To install realm-cli globally, I executed the following command:
npm install -g mongodb-realm-cli
However, every time I attempt to execute the login command realm-cli login (and confirmed that all other commands produce the same error), I always get the following error:
user@users-mbp ~ % realm-cli login
node:internal/child_process:413
throw errnoException(err, 'spawn');
^
Error: spawn Unknown system error -86
at ChildProcess.spawn (node:internal/child_process:413:11)
at spawn (node:child_process:757:9)
at Object.<anonymous> (/Users/user/.nvm/versions/node/v18.16.0/lib/node_modules/mongodb-realm-cli/wrapper.js:22:22)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
errno: -86,
code: 'Unknown system error -86',
syscall: 'spawn'
}
Node.js v18.16.0
I would like to clone an existing realm app with 3rd party HTTP services
I expect realm-cli to clone the app and all its 3rd party services.
The command fails with error "error writing http endpoints". Locally, an identical copy of the existing app is created, but in Realm UI, the new app created is completely blank.
First, create the parent realm app with 3rd party HTTP services in Realm UI. Then, clone the parent realm app:
> realm-cli apps create --remote [PARENT_APP_ID] --name [NEW_APP_NAME]
Observe that the following error is thrown:
app create failed: error writing http endpoints
Realm CLI Version: realm-cli version 2.0.0
I'm using mongodb-realm-cli version 1.1.0 and have no trouble logging in or running the export
command. However, I get errors running the diff
and export
commands.
✅ Works perfectly and generates a bunch of files.
node_modules/.bin/realm-cli export --app-id=my-app-id --output mongodb/realm --for-source-control
↪ tree mongodb/realm/
mongodb/realm/
├── auth_providers
│ ├── anon-user.json
│ └── api-key.json
├── config.json
├── functions
├── graphql
│ ├── config.json
│ └── custom_resolvers
├── services
│ └── mongodb-atlas
│ ├── config.json
│ └── rules
│ └── acronyms.acronyms.json
└── values
These same files are not working for the diff and import commands below.
I get this "could not find realm app" error even when I specify the app-id.
node_modules/.bin/realm-cli diff --app-id=my-app-id
could not find realm app
When I add the --path
optional parameter to my exported config I get a different error:
node_modules/.bin/realm-cli diff --app-id=my-app-id --path mongodb/realm
failed to diff app with currently deployed instance: error: must specify unique names when importing Services; duplicate name: mongodb-atlas
I'm confused why this complaining about this service name because I'm not able to change it in the Realm Data Source Configuration screen in Atlas.
node_modules/.bin/realm-cli import --app-id=acronyms-sandbox-kqpyx --path mongodb/realm --strategy=replace
failed to diff app with currently deployed instance: error: error validating Service: mongodb-atlas: only [wireProtocolEnabled, readPreference, readPreferenceTagSets] are allowed config options
It sounds like the import
command doesn't like the sync
entry in the config.json
(below).
Below is the contents of the services/mongodb-atlas/config.json
file that was exported by the tool:
{
"name": "mongodb-atlas",
"type": "mongodb-atlas",
"config": {
"readPreference": "primary",
"sync": {
"state": "enabled",
"partition": {
"key": "status",
"type": "string",
"permissions": {
"read": true,
"write": false
}
}
},
"wireProtocolEnabled": false
},
"version": 1
}
Sometimes the cli outputs extra information which can break deployment pipelines if not treated correctly.
When I run realm-cli secrets list --app feature-mule-20792-qewgs -f json
Im expecting that the output will only contain a single object in which I can find my secrets. But as you can see in the image above, the output of this command printed two extra objects, which, if not ignored, can break deployment pipelines. And since these objects appear only once, there is no reason for treating them in our scripts. In the image below you can see that in a second run those extra objects disappeared
My suggestion is to always have an expected output for each command, that also never changes in a major
version. And whenever you change the schema of the outputs, you should release another major version of this cli. If you release a minor
with a change in the schema, and developers use dependabot and koadiak to automatically update the version of the cli in their build images whenever a new minor
is released - like we do - this would break their builds.
If you really want to keep these alert messages, add them as an extra key called messages
inside the expected json, instead of printing as a separate object.
Hello,
I want to upgrade to the latest version but I don't want to deal with any breaking changes. I can't find anything that looks like release notes, a changelog, or a migration guide.
Can you please point me to this resource?
Thank you.
❯ realm-cli -v
realm-cli version 2.0.0-beta.6
I've made myself a github action that first exports the app, copies new files into /hosting/files and then tries to push the changes using the command line :
realm-cli push --local realm --remote *** --include-hosting --reset-cdn-cache -y
When running this command locally on a windows 10 machine, I'm rewarded with the output
Determining changes
Import hosting assets
Reset CDN cache
Successfully pushed app up: ***
The github action fails though with the following output:
shell: /usr/bin/bash -e {0}
Determining changes
push failed: EOF
Error: Process completed with exit code 1.
What can be the reason for this?
I've checked that the github action copies the new files into the /hosting/files folder before pushing.
Here's the action steps:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 15
- run: npm ci
- run: npm run build
- name: Realm
run: npm install -g mongodb-realm-cli@beta
- run: realm-cli -v
- run: realm-cli login --api-key ${{ secrets.MONGODB_REALM_API_KEY }} --private-api-key ${{ secrets.MONGODB_REALM_PRIVATE_KEY }} --realm-url https://realm.mongodb.com --atlas-url https://cloud.mongodb.com
- run: realm-cli pull --local realm --remote ${{ secrets.MONGODB_REALM_APPID }}
- run: mkdir -p realm/hosting/files
- run: touch realm/hosting/metadata.json
- run: cp -a dist/. realm/hosting/files/
- run: ls -la realm/hosting/files
- run: realm-cli push --local realm --remote ${{ secrets.MONGODB_REALM_APPID }} --include-hosting --reset-cdn-cache -y<!--EndFragment-->
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.