PermissionMiddlewareCreator on SmartAction causes request timeout

Feature(s) impacted

Smart Actions

Observed behavior

The Smart Actions were still working fine a week ago, but today we noticed that when we try to use one, the request stays in “pending” then get a 504 Response. It seems to happen on all SmartActions, on different collections.

On our staging environment there is no problem, and the code is the same.

The problem seems to come from the PermissionMiddlewareCreator. If i remove the middleware from the route, then it works again, but it’s not a viable solution.

Here is the code we use for these controllers :

const Liana = require("forest-express-sequelize")
const permissionMiddlewareCreator = new Liana.PermissionMiddlewareCreator('Company')
router.post(
  actionRoute,
  permissionMiddlewareCreator.smartAction(),
  actionHandler,
)

As i said if i remove the “permissionMiddlewareCreator.smartAction(),” then it works again.
Also, there is no logged error message server side.

Do you know why this could happen ?

Context

  • Project name: ma-domiciliation
  • Team name: any
  • Environment name: Production
  • Agent type & version: “forest-express-sequelize”: “~8.5.11”
  • Recent changes made on your end if any: no changes

Thanks in advance !

Hello @kmcb

We’re sorry to hear that you have issues with smartActions.

Is the problem still present ? We had some slow server response times around the time you created this topic and it could be the cause.
The staging environment you’re talking about, is it a remote environment or a development environment ? In development environment, the agent won’t check permissions for any action which can explain why you encountered no issue.

Hello @dogan.ay

Thanks for your answer, yes the problem is still present unfortunately.
The staging environment is also a remote environment.

After looking into it a bit more, I’m failing to see any changes that we could have made in the last week causing such an issue. Moreover, looking at the calls made from your production environment there weren’t any that resulted in an error.

Is the configuration for the smartAction similar between your production and staging environments ? Can you maybe share the name of your smartAction and the collection on which it is defined ? It may help me look into it a bit more.

When executing the smartAction, is it stuck on the middleware or does it, at some point, execute the business code ? From my side I can see that the agent did call our backend to retrieve permission configurations with success.

Hello, thanks for your answer

The action name is “Upload de kbis” on the collection “Companies”, but it seems to be the same on all Smart Actions.
The request is stuck on the middleware, the business code is never called.
I just tried again and it’s still the same.

Hello @kmcb,

Can you please share with us the exact version of forest-express-sequelize that you are using?

Can you also explain the kind of data that is sent to the smart action, if any? This would help us reproduce your issue.

Thanks

Hello @GuillaumeGautreau

We use this version : 8.5.11
Also the smart actions we tested use a “File” type field. Some also have a “String” field, but some only have the File field.

Hello @GuillaumeGautreau
I found the problem, it was because of a change i had made to the jwt config to fix another problem. Turns out it hadn’t been deployed on the staging environment.

Sorry for the inconvenience.

1 Like

Hello @kmcb,
We’re glad you have been able to resolve your issue.
Thanks for coming back to us with the cause and please do not hesitate to come back to the community support if you face any other issues.

Best regards