Giter Site home page Giter Site logo

mongodb-university / realm-template-apps Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 30.0 4.39 MB

The MongoDB Realm template apps source

Swift 5.96% JavaScript 34.76% C# 5.14% Java 1.85% Ruby 1.30% Objective-C 0.60% Kotlin 17.30% HTML 0.84% CSS 0.77% Shell 1.52% Dart 9.33% CMake 4.86% C++ 5.62% C 0.37% Objective-C++ 0.19% TypeScript 9.58%

realm-template-apps's People

Contributors

andrewzlchen avatar blagoev avatar cbullinger avatar cbush avatar dacharyc avatar desistefanova avatar edualonso avatar ericjordanmossman avatar jandersongo avatar jenniferpeshansky avatar krollins-mdb avatar malexandert avatar mongocaleb avatar mongodben avatar nathan-contino-mongo avatar nlarew avatar papafe avatar sudssm avatar takameyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

realm-template-apps's Issues

React Native todo app get stuck on npm and crashes when built on Mac

I'm trying to follow the tutorial here, but every time I run the sample app it crashes immediately.
https://www.mongodb.com/docs/atlas/app-services/tutorial/react-native/

Here's what I'm running:

realm-cli pull --remote [name of my app in atlas] --template react-native.todo.flex
cd TutorialApp/frontend/react-native.todo.flex
npm install

This will get stuck on reifying realm. So I blow away node_modules and packages-lock.json and run yarn instead.

rm -rf node_modules package-lock.json
yarn
npx pod-install
npx react-native run-ios

It takes a long time, but eventually tries to run the app. When it does, the app simply crashes with a BAD_ACCESS error. This is really weird because I'm able to build and run other React Native apps.

What gives? Am I doing something wrong here?

More details:
Mac OS X Ventura 13.4
XCode 14.3.1
2020 Intel MacBook Pro

Flutter - atlasUrl is missing in config

Atlas url is used in project but is missing in config

class Config extends ChangeNotifier {
  late String appId;
  late String? atlasUrl;
  late Uri baseUrl;

  Config._create(dynamic realmConfig) {
    appId = realmConfig['appId'];
    atlasUrl = realmConfig['dataExplorerLink'];
    baseUrl = Uri.parse(realmConfig['baseUrl']);
  }

  static Future<Config> getConfig(String jsonConfigPath) async {
    dynamic realmConfig =
        json.decode(await rootBundle.loadString(jsonConfigPath));

    var config = Config._create(realmConfig);

    return config;
  }
}

Call To Function is not passing the arguments

Hello team. Not sure if this is the right channel. But I was working on a presentation and using the template tiered from our docs, I realise there was something wrong.

So, inspecting further, I've seen that the call to function joinTeam is doing

const adminFuncArgs = [admin.id, "greenTeam", true /* make admin */];
const adminFuncResult = await admin.callFunction("joinTeam", adminFuncArgs);

The arguments are passed in an Array. The App Services function is defined as exports = async function (userId, teamName, isAdmin = false) and the problem is that all the arguments are stored in userId instead of being spread.

Therefore userId = [admin.id, "greenTeam", true] and teamName = undefined. So the $set is not working as expected as the filter will never work

The fix is pretty simple, just by editing two lines as follows:

const adminFuncResult = await admin.callFunction("joinTeam", admin.id, "greenTeam", true);
const funcResult = await member.callFunction("joinTeam", member.id, "greenTeam", false);

Realm Prop load error

When running the code through the android simulator, it errors out when initializing the RealmProvider. I get the following errors:

BUNDLE ./index.js

LOG View your data in MongoDB Atlas: https://cloud.mongodb.com/links/<...>/explorer/Cluster0/database/collection/find.
ERROR Error: Exception in HostObject::get for prop 'Realm': java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealm.so caused by: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~UrHcuOA1X7s9x-M8jCfU4g==/com.synctutorial-q5oSJsHgqnnBeIlJ_Vt4TQ==/lib/x86_64/librealm.so"... result: 0, js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient. A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient. A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

The react-native template pulled from realm platform does not initiate correctly with xcode 69.5

The app is correctly built, but when it is initiated, appears the next error on the simulator:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Error: Unable to resolve module ./index from /Users/user1/apps/learning-fm/MyRealmApp/.: <br><br>None of these files exist:<br> &nbsp;* index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)<br> &nbsp;* index/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)<br> &nbsp; &nbsp;at ModuleResolver.resolveDependency (/Users/user1/apps/learning-fm/MyRealmApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:136:15)<br> &nbsp; &nbsp;at DependencyGraph.resolveDependency (/Users/user1/apps/learning-fm/MyRealmApp/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)<br> &nbsp; &nbsp;at /Users/user1/apps/learning-fm/MyRealmApp/node_modules/metro/src/lib/transformHelpers.js:129:24<br> &nbsp; &nbsp;at Server._resolveRelativePath (/Users/user1/apps/learning-fm/MyRealmApp/node_modules/metro/src/Server.js:1137:12)<br> &nbsp; &nbsp;at async Server.requestProcessor [as _processBundleRequest] (/Users/user1/apps/learning-fm/MyRealmApp/node_modules/metro/src/Server.js:464:37)<br> &nbsp; &nbsp;at async Server._processRequest (/Users/user1/apps/learning-fm/MyRealmApp/node_modules/metro/src/Server.js:420:9)</pre>
</body>
</html>


RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_drain
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start_sim
0x0

I execute the npx react-native init command from the app main folder, the one which contains app.json, realm.json, ios and android folders, etc...

What am I supposed to do different?

Thank a lot in advance!

Screenshot 2022-08-27 at 16 18 41

Android With Kotlin Tutorial

I have followed the Android With Kotlin Tutorial but when I download the zip containing the front end code it is empty. As a result I used the CLI (appservices pull) but I cannot get the app to function correctly and I am not sure if this is an issue with the template or configuration that I have missed while following the tutorial.

On the Android device I can login successfully and get the following in the logcat
LoginEvent com.mongodb.app I User logged in successfully.

but then I am presented with a black screen and the logcat repeatedly outputs

REALM com.mongodb.app W [Core] Reading failed: End of input

What am I missing?

`flutter run macos` fails to build on M1

Error appears on this line of the app bar component:

class TodoAppBar extends StatelessWidget with PreferredSizeWidget {

image

flutter run full output:

Launching lib/main.dart on macOS in debug mode...
2023-06-13 18:47:42.616 xcodebuild[6282:571776] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-0014518C3E91801E }
{ platform:macOS, arch:x86_64, id:00006000-0014518C3E91801E }
lib/components/app_bar.dart:8:47: Error: The class 'PreferredSizeWidget' can't be used as a mixin because it isn't a mixin class nor a mixin.
class TodoAppBar extends StatelessWidget with PreferredSizeWidget {
                                              ^
Target kernel_snapshot failed: Exception

Command PhaseScriptExecution failed with a nonzero exit code
warning: Run script build phase '[CP-User] Download Realm Flutter iOS Binaries' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'realm' from project 'Pods')
warning: Run script build phase '[CP-User] Report Metrics' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'realm' from project 'Pods')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **

Building macOS application...                                           
Exception: Build process failed

the dart linter is also reporting the same error on the same line.

EMpty template app

When I download the template app it's empty - and I want to download because of the link
Screenshot 2023-11-19 052921
Screenshot 2023-11-19 052914
Screenshot 2023-11-19 052900
Screenshot 2023-11-19 052848

SwiftUI template app unable to maintain connection with flexible sync

The SwiftUI template todo app is unable to maintain a connection with MongoDB. The app itself works just fine, but it is unable to sync. The steps I'm taking are:

  1. Create a new app and download zip file from Atlas App Services
  2. Ensure appId and appUrl are correct in atlasConfig.plist
  3. Build and launch app on iPhone 14 Pro simulator
  4. Create a user via app and log in to the app
  5. Create todo items

I can see the created user in App Services, but no todos are ever synced. Opening the app on a different simulator confirms that there is no syncing happening. The following is output when the app launches and attempts to connect to flexible sync (I've removed some identifying info from these logs):

Sync: Realm sync client ([realm-core-13.10.1])
Sync: Connection[1]: Session[1]: Binding '[obfuscatedpath]/flx_sync_default.realm' to ''
Sync: Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false
Sync: Connected to endpoint 'x.xx.xxx.xx:xxx' (from 'xxx.xxx.x.xx:xxxxx')
Sync: Connection[1]: Closing the websocket with status='SystemError: invalid certificate chain', was_clean='false'
Sync: Connection[1]: Connection closed due to error

Where is the getUserItems defined?

I am trying to figure out how the flexible sync works, and when I am looking at this code:

Realm initRealm(User currentUser) {
  Configuration config = Configuration.flexibleSync(currentUser, [Item.schema]);
  Realm realm = Realm(
    config,
  );
  final userItemSub = realm.subscriptions.findByName('getUserItems');
  if (userItemSub == null) {
    realm.subscriptions.update((mutableSubscriptions) {
      // server-side rules ensure user only downloads own items
      mutableSubscriptions.add(realm.all<Item>(), name: 'getUserItems');
    });
  }
  return realm;
}

I am wondering, where is the getUserItems is defined? I can't find in the codebase: the https://github.com/mongodb/template-app-dart-flutter-todo.git

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.