As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
modules.collectionAccess.collection('user').find(query,callback) stopped working
P
Pankaj Chawla
started a topic
over 9 years ago
So I have a collection hook on a collection in which I query the 'user' collection. The query was working for last couple of months but seems to have stopped working now. The callback function doesnt get called at all. Is there some change in the collectionAccess of 'user' collection?
INFO 10:47:31 PM from request ff6c0e47e35e43e2b8036e5bb262bf0d in onPostSave
"outside query callback"
INFO 10:47:31 PM from request ff6c0e47e35e43e2b8036e5bb262bf0d in onPostSave
"got a save {\"_ccuName\":\"cm rom\",\"_id\":\"84549aa3b0938b58_2000\",\"damper_shape\":0,\"damper_size\":8,\"damper_type\":0,\"floor_name\":\"ff\",\"fsv_address\":2000,\"imei\":\"84549aa3b0938b58\",\"max_damper_open\":97,\"min_damper_open\":40,\"temperature_offset\":-20,\"zone_name\":\"a\",\"_acl\":{\"creator\":\"523be235bb59b95f550054a6\"},\"_kmd\":{\"lmt\":\"2013-12-18T17:17:31.024Z\",\"ect\":\"2013-10-28T06:54:23.361Z\"}}"
P
Pankaj Chawla
said
over 9 years ago
Here is the actual push notification definition as well:
This push notification has been working since September and stopped working sometime in the last few days. The query callback function doesnt get called at all.
M
Michael
said
over 9 years ago
The issue is that you are executing response.continue() outside the callback. Since find is asynchronous, it starts executing and then program flow continues. Once you execute response.continue, all further business logic callbacks are cancelled.
In the past, this code would sometimes continue unencumbered, but it was never supported. In fact, there would be many instances where the asynchronous code would fail previously in this type of scenario, so whether it succeeded or failed was hit or miss. We recently updated the code to enforce the documented behavior and make callbacks predictable.
To make this script work, place response.continue() immediately following modules.logger.info("found some matching users"); (make sure you also issue a response.error, response.continue, or response.complete in the error condition case of the callback.
P
Pankaj Chawla
said
over 9 years ago
HI Michael,
As updated in my last response, this is actually auto generated code in response to a push notification definition. As can be seen the response.continue() is part of the auto-generated code. This would mean that the auto code generation needs to fix this as any code changes that I do manually will get overwritten by any changes in the push notification definition. Let me know if my understanding is incorrect and I should manually edit the generated code?
M
Michael
said
over 9 years ago
Please manually edit the generated code. It will not get overwritten unless you make a change to the push trigger. I've submitted a bug report to our console team to ensure that the code generation gets fixed.
P
Pankaj Chawla
said
over 9 years ago
Thanks. I fixed the code manually and it is working correctly now.
Pankaj Chawla