Issue with permissions when adding permissionMiddlewareCreator.smartAction() to smart action routes

Feature(s) impacted

Smart action routes

Observed behavior

Error in permissions file - TypeError: Cannot read properties of undefined (reading ‘primaryKeys’) in permissions.js file

Expected behavior

Using permissionMiddleware.smartAction() without any trouble

Failure Logs

TypeError: Cannot read properties of undefined (reading ‘primaryKeys’)


  • Project name: …n/a
  • Team name: …n/a
  • Environment name: …localdev
  • Agent (forest package) name & version: …forest-express 10.1.9
  • Database type: …sequelize
  • Recent changes made on your end if any: …

Please can you share more context about your code and what you want to do, so that I can help you :pray:

Hi Alban, thanks for replying. Let’s see, I imported the middleware like so:

const { PermissionMiddlewareCreator } = require('forest-express-sequelize');
const permissionMiddlewareCreator = new PermissionMiddlewareCreator('cache_entry');

and here is an example route:

    .post(Liana.ensureAuthenticated, permissionMiddlewareCreator.smartAction(), itemsController.createItemHandler)

When I try the smart action, that’s when I run into a permissions issue in the Permissions.js file located here: node_modules/forest-express/dist/middlewares/permissions.js.

I’m guessing that this file was created on forest-express side so I’m very unfamiliar with its contents.

Is that helpful or what other context could you use?


I don’t understand what do you want to do, but do you have read the section about smart action in our documentation?
Also, did you try to upgrade your forest-express-sequelize to the last version ?

Just wanted to add permissions middleware to each smart action route. This solved it:
const { PermissionMiddlewareCreator } = require(‘forest-express-sequelize’);
const permissionMiddlewareCreator = new PermissionMiddlewareCreator(‘Item-Name’);

Thanks for your responses