Smart action inside smart collection not working

I have wrote smart collection and inside that I have added some smart action. It is not working. As I have wrote smart actions in many collection but in smart collection it won’t work. Can you help me to identify that what can be issue?

  • Express Version: 4.17.1
  • Sequelize Version: 5.15.1
  • Database Dialect: MySQL
  • forest-express-sequelize: 8.0.0

Hi @Mayur_Malaviya,

Can you please share what was tried to make this smart collection + smart action?

Regards

@Sliman_Medini Suppose, I am creating food delivery application. I have application where I wanted to collect data which are past orders, user details, order amount and all. For that I have created smart collection. Moreover, I would like to send bill by mail to all selected users for that I would like to create bulk action.
Note:
I have already created same functionality with version 7 but In this project I am using version 8 but it’s not working.

@Mayur_Malaviya, thank for this explanation.

Can you please share the smart collection definition, and the smart action definition?

Regards

Definition of Smart collection:
collection(‘past_orders’, {
isSearchable: true,
actions:
[{
name: ‘Send Receit In Mail’,
type: ‘single’,
}],
fields: [
{
field: ‘OrderId’,
type: ‘String’,
get: (order) => {
return order.id
}
},{
field: ‘OrderDate’,
type: ‘Date’,
}, {
field: ‘OrderStatus’,
type: ‘String’,
}],
});

Definition of Smart Action:
router.post(’/actions/send-receit-in-mail’, permissionMiddlewareCreator.smartAction(), (req, res, next) => {
console.log("===========Inside action====");
return res.send({success: “receit”});
});

Thank you.

This seems to be working code, what error do you face with?

Regards

When I click on action it won’t console. which I wrote in my action.

Hi @Mayur_Malaviya,

We reproducted the issue. A bug ticket was created and can be followed here.
Thank you for this feedback.

To help waiting for the bug to be solved:

  • it works by downgrading to v7
  • it works by removing the .smartAction middleware but this is strictly discouraged since it open the route to any caller.

Regards

@Sliman_Medini Thanks for your support and raise this bug.

Can you tell me when it can be resolved? or How can I make it workable?

As you mention above 2 ways:

  • I can’t downgrade version because there are many difference in version 7 and 8.
  • As you mention to remove .smartAction middleware is not best way

Can you suggest me approximately when it can be done? or if it will be done will you update me?

Thanks

Hey @Mayur_Malaviya,

Could you give our latest (forest-express-sequelize@8.4.6) a try? It should embed the fix :+1:

Let me know if everything works as expected on your end :pray:

@jeffladiray Yes, that issue is resolve in 8.4.6 version. Should I use forest-express-sequelize@8.4.6 version instead of 8.0.0?

Thanks

Since 8.4.6 contains the required fix, I would suggest to either keep it 8.4.6, or ^8.4.6 depending on your needs

Okay, I will keep as per my requirements. Thanks

1 Like

@jeffladiray As you suggest I had upgrade version with 8.4.6 then I degrade back my version with 8.0.0. but I my Smart collection seems error. timezone is undefined issue shows.
Even I tried to upgrade version again still it seems same issue that timezone is undefined.

Can you suggest what can be issue?

Hey @Mayur_Malaviya :wave:

Did you recently upgrade to v8? timezone is undefined is most likely an upgrade error (But I can’t be sure really).
Eventually, could you share:

  • The full stack trace of the issue
  • The HTTP request and response of the failing call (The one triggering the timezone error, as DM if you consider it private)
  • Eventually a video clip showing how you are able to trigger the error

v8.4.6 contains the fix for smart action on smart collection. Rollbacking to 8.0.0 will re-trigger the smart action error.

Once I have the required info, we should be able to help you debug this :pray: