Hi there
Expected behavior
Using permissionMiddleware.smartAction()
without any trouble
Failure Logs
Error: Impossible to retrieve the smart action at endpoint /forest/actions/ubo/create/ and method POST
Context
Smart Action decorator :
@Post("forest/actions/ubo/create")
Our middleware :
@Injectable()
export class SmartActionPermissionMiddleware implements NestMiddleware {
async use(req, res, next) {
if (req.body.data.attributes.collection_name) {
const permissionMiddleware = new forest.PermissionMiddlewareCreator(
req.body.data.attributes.collection_name,
);
if(Array.isArray(permissionMiddleware.smartAction())) {
await Promise.all(permissionMiddleware.smartAction().map(middleware => new Promise((resolve, reject) => {
middleware(req, res, resolve)
})))
return next();
}
return permissionMiddleware.smartAction()(req, res, next);
}
return next();
}
}
We saw on your commit that you verify the smartActionEndpoint
adding the request.path
to the request.baseUrl
.
The request.path
is equal to /
and so :
forest/actions/ubo/create != forest/actions/ubo/create/
Is there something to change on our side to avoid that error ?
- Package Version: 8.2.8
- Express Version: 4.17.1
- Sequelize Version: 5.22.3
- Database Dialect: postgresql
- Database Version:
- Project Name: Swan Back-Office