Unexpected error when executing smart actions (V8 + Multiple DBs)

Feature(s) impacted

Two days ago I posted a topic here with some questions I had when including another database in my project. The issue was solved, and later I decided to upgrade the project to V8 since I wanted to take advantage of some features released on load hook and change hook. However, all smart actions give me a 500 error when executed.

Observed behavior

All smart actions show an error like below when executed.

I’d like to point out that the hooks execute as expected given that I successfully load some data (coming from the database) to a dropdown field in the smart action form. On the other hand, the route associated with the smart action does not execute, which makes me think the problem happens in-between, maybe?

Expected behavior

Expected all smart actions to be working properly.

Failure Logs

This is the result after inspecting the page:

Context

  • Project name: parceiros
  • Environment name: development
  • Package Version: 8.0.0 (forest-express-mongoose)
  • Engine: nodejs
  • Engine Version": 10.24.1

Hey @nivea :wave:

Could you please share here or as DM:

  • The smart action code (With the route definition, defined in /routes/your_model.js)
  • The Forest action definition (Defined in /forest/your_model.js)

Looking at the error, I’m expecting a difference between your smart action name & the route name used.

Thanks in advance

Thanks, I’ve received the file.
Could you also check your agent logs to see if any issue appear there?
And finally, could you send the HTTP request and response that trigger the HTTP 500 ?

Thanks in advance

I’m executing the project through docker, so here are the logs presented until I trigger the smart action:

Also, does the failure log I mentioned above correspond to the HTTP request you are asking for?

It does. I would suggest to wrap your smart action code (The one located in /routes) in a try/catch block so you should be able to get more informations of what going on - and why your server is throwing this error 500.

I tried doing that, but the problem seems to be that the code in /routes is not even triggered. I tested a console.log() at the beginning of the function and that was not even printed :disappointed:

@nivea

Any furthers logs in your chrome browser?
Any specific CORS configuration that could make this fail?
Could you also try the same action without the permissionMiddleware call, just to check if everything works fine without it ?

It worked without the permissionMiddleware call.

Ok, I’m able to reproduce the issue. It seems like there is an issue with `permissionMiddlewareCreator.smartAction(). I’m opening a ticket on our end, so be sure you’ll be pinged once fixed.

All right, I appreciate it :slight_smile:

1 Like

Hi @nivea :wave: unfortunately my team mate speak a little fast.
We can’t reproduce. Please can you check if you install the latest version of forest-express-sequelize?

npm ls forest-express-sequelize
// or
yarn list forest-express-sequelize

Hey @Arnaud_Moncel

I have not installed this package. After executing the command you suggested, it returns -- (empty).
I just have forest-express-mongoose in my dependencies:

"dependencies": {
    "body-parser": "1.19.0",
    "chalk": "~1.1.3",
    "cookie-parser": "1.4.4",
    "cors": "2.8.5",
    "debug": "~4.0.1",
    "dotenv": "~6.1.0",
    "express": "~4.17.1",
    "express-jwt": "6.0.0",
    "forest-express-mongoose": "^8.0.0",
    "mongoose": "~5.8.2",
    "mongoose-bcrypt": "~1.9.0",
    "mongoose-unique-validator": "~2.0.3",
    "morgan": "1.9.1",
    "onesignal-node": "^3.2.1",
    "phone": "^3.1.10",
    "require-all": "^3.0.0"
  }

If it is of any help, I’m attaching the errors shown in the Chrome console.

log_errors.tar (36 KB)

Oh yeah you use mongoose sorry about that, So what is the result of the same command using forest-express-mongoose instead of fores-express-sequelize :pray:

Can you share with us the request payload and the response of the failing request from your browser network tab please :pray:

If I use forest-express-mongoose, it just returns -- forest-express-mongoose@8.0.0.

The request and response from my browser are below:

Can you try to update to the latest version which is v8.4.5 and retry ?

@Arnaud_Moncel

Upgrading solved the problem. Thanks a lot :pray:

1 Like