-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Got multiple apps working on one server successfully, why no official support? #1979
Comments
Concurrent cloud code requests will affect the Parse js SDK and the applicationId won't match. There is a big chance that all cloud code requests for your first app will end up affecting your second. So yes, that works only if you don't use cloud code |
This issue is asynchronous Cloud Code. The issues will only show up when a) both apps are receiving requests at the same time, and b) your Cloud Code does asynchronous stuff like making queries or writes. |
Oh, now I see. I'd experienced an interesting issue while configuring parse server in my way. Whenever I didn't set serverURL for one of applications, other applications couldn't send requests to their own databases either! (which logically is odd. because one application may use Cloud Code and other may not). So Cloud Code gets broken is some way with this configuration. Thank you @flovilmart and @drew-gross for pointing this out. Since hosting multiple applications is more important than using Cloud Code for me, I will abandon Cloud Code for now, and use PHP requests to simulate Cloud Code functionality in my applications. |
You could also run multiple parse servers in multiple processes, on different subdomains or ports. |
I missed a little thing. The problem you said about Cloud Code, is it because of using one server for all applications, or sharing /parse as mount path? I mean, can this problem be solved by using exclusive mount path for each application? |
The JSSDK is a global object, you will encounter problems with your cloud code as soon as you have concurrent calls on your apps. |
@flovilmart @drew-gross My cloud code is running. The only problem seems to be that the internal serverURL is shared so that requests to the cloud API go to the same URL. Can you point me to the singleton object. I'd like to attempt to fix this. |
the whole JS SDK is a singleton, probably other parts of parse-server don't play well with multiple apps.
That's not the only problem, also your appId, jsKey, context, variables. if another request comes in when processing the previous one from another app, your whole context would get f...d up. If you're unsure, please read: #263 and particularly: #263 (comment) |
Like most of Parse.com users, I've got multiple applications running in my Parse account. So I was curious to know if there is any way to do this on a self-hosted parse server or not. After trying different approaches (even running independent server per application, which is a crazy idea!) this is my final configuration which make me able to run multiple applications on one parse server:
With this configuration inside index.js file, I was able to make both application running on https://mydomain.com/parse and each could be authorized using their own appId and masterKey. Even Cloud Code for each application is working without any problem.
The point is that, why this ability isn't officially documented? Parse developers are saying that running multiple applications on same server isn't supported (Even when I want to run parse-server with terminal command and a configuration for multiple applications, I get an error saying running multiple applications isn't supported). But as I said, I was able to this by editing index.js file in source code like above.
All of these things make me think that I'm missing something. Am I?!
The text was updated successfully, but these errors were encountered: