Smart Action Route does not handle `permissionMiddlewareCreator.update()` on v9

Feature(s) impacted

Smart Actions when used with permissionMiddlewareCreator.update()

Observed behavior

const pmc = new PermissionMiddlewareCreator("EngagementFormField")"/actions/fields-down", pmc.update(), (req, res) => {

This Smart Action fails (see Failure Logs) whenever called. It used to work perfectly on v8.

Expected behavior

The Smart Action should work as intended.

Failure Logs

2022-12-06T14:13:16.273029+00:00 app[web.1]: POST /forest/actions/fields-down?timezone=Europe%2FParis 424 144 - 9.275 ms
2022-12-06T14:13:16.273193+00:00 app[web.1]: Error: Failed Dependency
2022-12-06T14:13:16.273205+00:00 app[web.1]:     at Request.callback (/app/node_modules/@forestadmin/forestadmin-client/node_modules/superagent/lib/node/index.js:929:17)
2022-12-06T14:13:16.273205+00:00 app[web.1]:     at /app/node_modules/@forestadmin/forestadmin-client/node_modules/superagent/lib/node/index.js:1174:20
2022-12-06T14:13:16.273210+00:00 app[web.1]:     at IncomingMessage.<anonymous> (/app/node_modules/@forestadmin/forestadmin-client/node_modules/superagent/lib/node/parsers/json.js:22:7)
2022-12-06T14:13:16.273211+00:00 app[web.1]:     at IncomingMessage.emit (node:events:525:35)
2022-12-06T14:13:16.273211+00:00 app[web.1]:     at endReadableNT (node:internal/streams/readable:1359:12)
2022-12-06T14:13:16.273212+00:00 app[web.1]:     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)


  • Project name: Pinpo Admin
  • Team name: Operations
  • Environment name: Production
  • Agent type & version: forest-express-mongoose: 9.0.3
  • Recent changes made on your end if any: None.

Hello @fbeiger

I just checked, and as per documentation smart actions should use the permissionMiddlewareCreator.smartAction() decorator.

Note that you may also need to add the request.user and request.query parameters to calls to the RecordsGetter constructor in smart action routes / route overrides if you are using those.'/actions/mark-as-live', permissionMiddlewareCreator.smartAction(), (req, res) => {
  const recordsGetter = new RecordsGetter(companies, request.user, request.query);
  return recordsGetter.getIdsFromRequest(req)
    .then(companyIds => companies.update({ status: 'live' }, { where: { id: companyIds }}))
    .then(() => res.send({ success: 'Company is now live!' }));