Giter Site home page Giter Site logo

realm-cli's People

Contributors

andrewzlchen avatar arahmanan avatar asudhakal avatar auddin431 avatar boubascript avatar chickenbug avatar dpish avatar edaniels avatar ermay12 avatar gabri3l avatar haleyowen avatar jandersongo avatar jo-tse-mongo avatar joshmadewell avatar kpatel71716 avatar lijiezhang1998 avatar lorepozo avatar makesitgo avatar malexandert avatar mattchiaravalloti avatar mburdette avatar mpobrien avatar nathantfrank avatar nbsquare avatar niharika01 avatar sudssm avatar tkaye407 avatar tsedgwick avatar unicodesnowman avatar yarai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

realm-cli's Issues

arm64 support

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

realm-cli push -y --project=PROJECT_ID does not create new app when realm_config.json exists

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

image

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.

Realm-cli does not show ID of pushed app instance

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)

Disable deployment spinner when --disable-colors is true

There should be a way to prevent the spinner being displayed - e.g. this one:

s := spinner.New(terminal.SpinnerCircles, 250*time.Millisecond)
s.Suffix = " Deploying app changes..."

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.

Unable to transpile node module installed from local folder

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

Add parameter "--no-verbose"

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

cant_turn_off_realm_cli_message

We would very much like to be able to turn off verbose output, something like the "--no-verbose" flag.

supported Realm app locations incomplete

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...

  • I can create a new app with pushing my files and selecting DE-FF as location
  • but I'm not asked what provider_region I want
  • The app is created with "Frankfurt (eu-central-1) • AWS"
  • I can then pull this new app
  • but after adding the provider_region and trying to push, I get 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?

The error "push failed: stream timeout" does not invoke EXIT_FAILURE

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.

Push failing, unknown flag: --app-id

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!

Every `push` shows changes to environment values even when nothing has changed

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?

Realm-cli apps create –remote could not find or can’t clone secret keys

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

realm-cli push 500 Internal Server Error

I'm trying to run realm-cli push in a development app and I'm getting error 500.
image
image

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?

Unable to login on mac m1

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',
    '*****'
  ]
}

Schemas are not exported correctly (v.1.3.4)

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?

Push giving error with nested Functions

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. cding 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.

Huge unpacked size on npm (version 2.6.0)

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.

image

On the version 2.5.0 it was: 10.8 MB.

image

This same problem already had happened before on the version 2.4.1.

image

Error when executing `realm-cli`

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?

Deployed app is identical to proposed version, nothing to do

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.

doesn't find server with new/empty profile

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.

Export with --for-source-control key does not seem to match documentation

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

Unable to push graphql custom resolvers with same `field_name`

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

image

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

Apps init --name flag issue

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"

iOS with UIKit template is "not compatible"

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

realm-cli push has issues with UTF-8 characters

  • pulled application with a function that has utf characters
  • pushed function to another application
  • push fails
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.

Exporting creates static hosting files with execute bits set

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.

"fields" and "additional_fields" ignored in sync/config.json

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.

import command for deploy is giving nonsense error about maximum database trigger

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?

No notice of breaking change: type 'mongodb-atlas' now requires config value 'clusterName'

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?

Pull command is nondeterministic

The config.json file created by the pull command randomly changes the order of the function names keys, creating spurious changes:

image

edit: JIC, I didn't change anything related to functions

Realm-cli does not display any changes when pushing new instance

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)

Realm CLI installation failed: Error: Only Windows 64 bits supported.

I am trying to install realm-cli via npm globally using the following command npm install -g mongodb-realm-cli

Windows 10 64 Bit
image

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

Cloning a realm app creates an identical realm_config.json file locally

Goals

I would like to clone a new realm from an existing realm app.

Expected Results

I expect realm-cli to clone everything from my existing realm app, but to create a unique realm_config.json file locally

Actual Results

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.

Steps to Reproduce

> 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

Environments not provided failure in CLI v1.3.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.

Screen Shot 2021-02-22 at 10 58 00 AM

"Pull" command includes app and cluster configuration fields

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

Unable to install realm-cli on ubuntu 20.04 / npm 6.14.4

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.

Default value required for --auth-type

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...

realm-cli is not working for arm64 (M2 chip)

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

Cloning a realm app with 3rd party HTTP services fails with error "error writing http endpoints"

Goals

I would like to clone an existing realm app with 3rd party HTTP services

Expected Results

I expect realm-cli to clone the app and all its 3rd party services.

Actual Results

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.

Steps to Reproduce

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

Errors from diff and import commands

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.

Export

✅ 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.

Diff

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.

Screen Shot 2020-10-26 at 3 27 01 PM

Import

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).

config.json

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
}

Remove any warning/alert messages from the outputs

Sometimes the cli outputs extra information which can break deployment pipelines if not treated correctly.

image

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

image

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.

Can't find v1 -> v2 release notes, migration guide?

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.

Push fails in github action but succeeds locally

❯ 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-->

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.