Cannot update the Smart Relationship (FK) of a record (or even insert it)

Feature(s) impacted

  • When trying to update the Foreign Key (Smart Relationship) of a record, we receive this error
    “An error occured when trying to edit MODEL_NAME : not found.”

  • When trying to insert a new record, the data are well persisted, the record is created, but the Smart Relationship remains empty even if we specify it in the Form.

Observed behavior

“An error occured when trying to edit MODEL_NAME : not found.”

Expected behavior

(When updating the record) The FK should be updated and not get an error.
(When creating a new record) The FK should be created and not empty when specified.

Failure Logs

404 Error
HttpError: HTTP Error 404: at e.throwHttpErrorIfResponseNotOk


  • Project name: Elyps
  • Team name: Elyps
  • Environment name: dev-cli
  • Agent (forest package) name & version: “forest-express-sequelize”: “^7.12.3”
  • Database type: sequelize ORM version “~5.22.5” x MySQL

Hello @emirc

I cannot reproduce on my end

Can you please try to upgrade the forest-express-sequelize package ?

If this does not solve your issue can you please share the configuration of your relationships ?


Hello @nbouliol ,
Thank you for your answer!

We just upgraded from forest v6 to v7, we had this problem even with the v6. Upgrading to v8 may solve the problem you think?

Hello @emirc

On which endpoint do you receive the 404 http error ?


On this endpoint: Cannot PUT /forest/Account/46/relationships/Person

What kind of smart relationship is it ? Is it a belongs to or a has many relationship ?

I cannot reproduce locally, can you please share the declaration of the relationship ?

Thank you

It’s a belongsTo smart relationship; Person & Account are two models present in different databases so that’s why we are using a smart relationship and not an ordinary FK. Here is how it’s setup:


      field: 'Person',
      type: 'String',
      reference: '',
      get(account) {
        return personsModel.Person.findOne({
          where: { id: account.PersonId },


const Account = sequelize.define(
      uuid: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
      createdAt: {
        type: DataTypes.DATE,
      updatedAt: {
        type: DataTypes.DATE,
      PersonId: {
        type: DataTypes.INTEGER,
      tableName: 'Account',

Hello @emirc, thanks for the schema definition.

Indeed, this way of defining a relationship outside sequelize will not allow you to use native Forest Admin CRUD (Create Read Update Delete) in the context of this relationship.

However, your use case should be covered by defining a smart relationship within your customizations

Another option is to implement the logic that you are looking for by extending or overriding Forest routes.

Let us know if any of those options would work for you.


1 Like

Hello @Nicolas.M , thank you for your answer!
It was working pretty fine months ago using smart relationships and without overriding the routes.

I will try to customize the route and will keep you updated

The problem is fixed when I override the route by implementing the logic of creating and updating the record (POST and PUT methods)

Just FYI, this feature was working before without the need of overriding the routes.

Thank you for the support