-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple instances of strong-remoting causes assertion error on "sharedClass instanceof SharedClass" #9
Comments
Wiping my node_modules dir, remove loopback-connector-remote from my package json, and npm installing seemed to fix the issue. |
This is caused by the fact that loopback-connector-remote bundles its own copy of strong-remoting and therefore it calls a different copy of We should rework the connector to use the strong-remoting copy installed in the loopback app. |
Can this be done by making Strong-Remoting a peer dependency? |
It will solve the problem in most cases, but not in all of them.
|
Just noticed that loopback requires the remote connector. Is it necessary to require the remote connector in my package.json file? Also, this is how my project is currently structured and it is working fine.
|
No. In fact, it's better to NOT include it in your package.json and always use the one provided by loopback. At least until the this issue and #5 are resolved. |
I can confirm this is an issue as I just ran into it. I fixed it by running |
Just ran into it this in another project. Due to the nature of the project (we are using rxjs) the error stack trace was reporting it as an error within rxjs and not loopback. Would yall be open to a PR that makes the assert message descriptive, as |
👍 ✖️ 💯 |
@ritch 's solution is much cleaner. |
We should still review all places where the remote connector is using strong-remoting and ensure we won't be bitten by the fact that there are multiple SharedClass around. |
Can you create an issue for this if you think its important? |
The connector directly depends on strong-remoting, which is a recipe for problems, as it causes multiple instances of the strong-remoting to be loaded in the Node process. See below for an example.
Using loopback-connector-remote 1.0.2, loopback 2.8.0.
Bundling loopback and serving to client. On initiation, my app crashes with
Uncaught AssertionError: false == true
, not a very helpful error message.After some investigation, seems like this statement is the cause. Not sure what the solution would be since it seems like sharedClass object is an instance of SharedClass in this case but fails the test.
The text was updated successfully, but these errors were encountered: