Hi,
Is there any difference between running BusinessLogic in Debug vs Production?
I have User afterRegister Event.
Its working as expected when running under Debug (npm run debug) and not when running after deploying to Production ( npm run deploy). Is there any difference in their execution,
btw, app is not live yet does it depend on it.
Thanks
can i get some info here…
Thanks
There should not be much different between debug and production, could you provide your application id?
part of my coderunner.json file:
"app": {
"id": "EEE6E864-900B-8F1F-FFBD-4D9AA308AF00",
"secretKey": "6F0CF61F-2095-131C-FFA7-EF175781FC00",
"version": "v1",
If i keep my npm run debug, everything working fine, but if i run npm run deploy and on completion, if i try to test, its not working as expected.
Login in afterRegister.js:
Find other User depending on ownerId (say user1)
Provide Find, Update Permissions to req.result [ current user] and above searched user1
Thanks
In your JS code I see you enable promises, but then continue using the Backendless.Async approach. That is wrong and it will not work. Once you enable promises, you have to use the promises-based approach.
Thanks Mark. I commented Backendless.enablePromises(); and looks like its working as expected.
I will look into changes to Promises after major fix.
Thanks
Hi Mark,
I still see the same issue. Not sure if Async checkbox in the Interface has anything to do with Promise way of implementation.
abstract here is the code:
Backendless.ServerCode.User.afterRegister(function(req, res) {
Backendless.enablePromises();
//Retrieve actual user object so that i can run grantUser, else throwing exception
Backendless.Persistence.of( Backendless.User ).findById( res.result.objectId).then(userById).catch(gotError);
function userById(identity) {
Backendless.Data.Permissions.FIND.grantUser(identity.email, identity)
.then(userPerm1).catch(gotError);
pIde = Backendless.Persistence.of( Backendless.User ).findById( res.result.ownerId)
.then(userByPId).catch(gotError);
}
function userByPId(id) {
Backendless.Data.Permissions.FIND.grantUser(pIde.objectId, kidIde)
.then(userPerm1).catch(gotError);
}
}); //removed ,true to remove Async Checkbox
Big question is, why its working in debug mode and not in Production
Thanks
Hi Sudheer,
How do you verify that it is not working in Production? Could it be that the code takes more than 5 seconds to execute? (this is the limit of the free tier)
Mark
Thanks Mark, i am not aware of it… probably its taking more than 5 sec’s as i am querying and setting ACL Permissions. for now, will move code to app side.
Thanks