smartAction is not a function

This is a template you can use to report issues. You can also drag images, videos and include Preformatted text

Expected behavior

Create a smart action following the docs

https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions#opening-a-form-to-ask-input-values

Actual behavior

TypeError: permissionMiddlewareCreator.smartAction is not a function

Failure Logs

  // Upload CSV to account
  router.post('/actions/upload-csv', permissionMiddlewareCreator.smartAction(), (req, res) => {
    const accountId = req.body.data.attributes.ids[0]
    console.log('accountID', accountId)

    const attrs = req.body.data.attributes.values
    const csv = attrs.csv
    console.log('CSV', csv)
    res.send({ success: 'CSV Uploaded' })
  })

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version: 4.16.3
  • Sequelize Version: 5.15.1
  • Database Dialect: Postgres
  • Database Version:
  • Project Name:
	"dependencies": {
		"chalk": "~1.1.3",
		"cookie-parser": "1.4.4",
		"cors": "2.8.5",
		"cross-env": "^7.0.2",
		"debug": "~4.0.1",
		"dotenv": "~6.1.0",
		"express": "~4.16.3",
		"express-jwt": "5.3.1",
		"forest-express-sequelize": "^5.5.0",
		"https": "^1.0.0",
		"morgan": "1.9.1",
		"pg": "~6.1.0",
		"require-all": "^3.0.0",
		"sequelize": "~5.15.1"
	},

Hi @NFhbar,

Welcome to the ForestAdmin community and thank you for sharing your concern with us!

permissionMiddlewareCreator is a middleware creator provided by the forest-express-sequelize library.

On the route file where you defined your upload-csv route, could ensure that you correctly imported and instantiated the permissionMiddlewareCreator:

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