question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node.js and Sync can't found 'User'

See original GitHub issue

Hello, I’m trying to follow the documentation regarding using realm with Node.js and the sync functionallity.

I’m running the realm mobile plattform in a ubuntu 16.04 virtual machine and it is working properly. I’m using node v7.5.0 and npm 4.1.2 I installed realm for nodeusing: npm install --save realm

And I test it locally using the NodeInterprocess example and it is working.

However when I try to use the example code to sync:

'use strict';
var Realm = require('realm');

Realm.Sync.User.login(/* ... */, (error, user) => {
  if (!error) {
    var realm = new Realm({
      sync: {
        user: user,
        url: 'realm://object-server-url:9080/~/my-realm',
      },
      schema: [/* ... */]
    });

    realm.write(() => { 
      /* ... */
    })
  }
})

I receive the following error:

Realm.Sync.User.login('realm://192.168.1.230:9080', 'user@email.com', 'password', (error, user) => {
          ^

TypeError: Cannot read property 'User' of undefined
    at Object.<anonymous> 
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:533:3

Am I missing something?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
fotiDimcommented, Mar 13, 2017

@kristiandupont according to https://realm.io/pricing “Two-way, Realtime Synchronization” is supported for the Developer Edition. If this is only for MacOS you should explicitly mention that.

What about Server-side Access and Event Handling? Are they supported on any OS for the Developer Edition?

2reactions
fotiDimcommented, Mar 9, 2017

@kristiandupont what is the reasoning behind making sync only available on MacOS? It doesn’t make sense to me. If it’s a server chances are it will be Linux.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module 'readline-sync' : Node.js
js before, and I have been researching the answer to this question, but I have had no luck. I am trying to allow...
Read more >
6 reasons your Node.js apps are failing - IBM Developer
Can't figure out why your Node.js applications are failing? This article covers common Node failure points and the open source tools you can...
Read more >
Errors | Node.js v19.3.0 Documentation
User -specified errors triggered by application code. ... With few exceptions, Synchronous APIs (any blocking method that does not accept a callback function ......
Read more >
Settings Sync in Visual Studio Code
Syncing Stable versus Insiders. By default, the VS Code Stable and Insiders builds use different Settings Sync services, and therefore do not share...
Read more >
Top 10 Most Common Node.js Developer Mistakes - Toptal
We can overwrite exports to do this, but we must not treat it as a global variable then: // a.js module.exports = function(user,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found