Trouble with custom relationship table

Also the oddest thing is that my devellopment environement is fine

(PS: also i have created a smart action so that update the FeatureMappingStatus of the SoftwareFeature and everything work fine)

Hi @Benjamin_Marquis,

I would like to have access to your codebase to try reproducing your issue :wink:. Tell me how you want to. My github account is vincentmolinie

Hi @vince, thanks for helping sorry i was unavailable the last days.
could i have an email address, the project is on bitbucket :slight_smile:
(or i could clone it temporally on a github account, or send you a zip )

Hi @Benjamin_Marquis,

I’m not able to download your SQL backup, could you re-upload it so I could test on my end ?

Thanks in advance :pray:

Hi @jeffladiray thanks for helping !
https://we.tl/t-RK0ZTlN8Qt

Hello :slight_smile: where you able to download the database? @jeffladiray

Hello, hello, is there any news or do you need any more information I can give you ? :slight_smile:
@Steve_Bunlon @jeffladiray @vince

Hi @Benjamin_Marquis,

Sorry for the delay our answers, part of the team was unavailable lately. As a result this new backup link you gave us has expired too.

Could you share it once again (alongside with the video of the issue too), i’ll make sure that we store it on our end so we won’t have to ask for it ever again :pray:

Thank you

Hello! No worries thanks for helping, here are the documents:

And I coudl give an access to the repo if needed

Thanks for your help have a good day

Hello @Benjamin_Marquis,

On behalf of the team, sorry again for the time it takes to find a suitable answer to your issue.

Would you mind checking that your code is in sync between you “Development” and “Production” environments? Our internal data shows the “id” column of the “software_feature” model for the “Development” environment but not for “Production”.
Please update the code in production if applicable and restart the forest agent.

If this is not, or does not solve, the issue, is possible for you to copy the development layout to the production environment?
As mentioned in our documentation (https://docs.forestadmin.com/documentation/reference-guide/project-settings/environments-tab#creating-a-new-environment) this will overwrite the production layout with the development one. Please only do so if you are satisfied with the current behaviour of your development environment.

You can also try to add a new staging environment to your project, with the code from the development environment, and copy its layout there.
This might be a safer first test.

Hi @anon79585656 thanks for helping,

The code are the same for both environments ( I implemented smart actions after the glitch and it works in production)
I also copied the layout multiple times.
I deploy using Kubernetes so i belive the forest agent is restarted every time I deploy.

It is reallly a weird bug!

Hi :wave:,

As @anon79585656 just told me this morning, we might be onto something.
I can see a differences between your software_feature definition on the “Production” and “Development” environment. It seems that the id column is missing, which seems to correspond with the fact that you are getting a composite id instead of your default id.

According to what I see in the forest-express-sequelize code visible here, the fact that this id is missing will trigger the composite key code generation, leading to your issue.

As stated above

You can also try to add a new staging environment to your project, with the code from the development environment, and copy its layout there.
This might be a safer first test.

I totally agree with that. If your able to reproduce on a freshly created environment with a copy layout, that would help us find the original issue.

Thanks for your patience :pray:

Hi @jeffladiray sorry for the delay

It software_feature seems they have same structure no ?

But i noticed join table always “create” 2 ligne in the left panel, why is that ?

I’ll try create a fresh environement!

thanks for you help

@jeffladiray i redeployed a beta environement and copied the layout but seems there is still a problem :confused:

Hi @Benjamin_Marquis,

Looks like you dev/beta/production environments return the exact same schema now, it looks perfectly fine here.
We discovered that your .forestadmin-schema.json returns 2 “software features” collections; a first one named software_feature and a second one named softwareFeature.

The softwareFeature collection looks to be well defined (with the “id” column):

{
            "id": "softwareFeature",
            "type": "collections",
            "attributes": {
                "icon": null,
                "name": "softwareFeature",
                "fields": [
                    {
                        "type": "Date",
                        "enums": null,
                        "field": "createdAt",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    },
                    {
                        "type": "Number",
                        "enums": null,
                        "field": "feature",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": "feature.featureIdKey",
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true,
                        "relationship": "BelongsTo"
                    },
                    {
                        "type": "Number",
                        "enums": null,
                        "field": "featureMappingStatus",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": "featureMappingStatus.featureMappingStatusIdKey",
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true,
                        "relationship": "BelongsTo"
                    },
                    {
                        "type": "Number",
                        "enums": null,
                        "field": "id",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    },
                    {
                        "type": "Number",
                        "enums": null,
                        "field": "software",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": "software.softwareIdKey",
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true,
                        "relationship": "BelongsTo"
                    },
                    {
                        "type": "Date",
                        "enums": null,
                        "field": "updatedAt",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    },
                    {
                        "type": "Date",
                        "enums": null,
                        "field": "updated_at",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    }
                ],
                "nameOld": "softwareFeature",
                "isVirtual": false,
                "isReadOnly": false,
                "integration": null,
                "isSearchable": true,
                "paginationType": "page",
                "onlyForRelationships": false
            },

and the software_feature collection is incomplete and defined as a collection with a composite primary key based on feature_id / software_id:

{
            "id": "software_feature",
            "type": "collections",
            "attributes": {
                "icon": null,
                "name": "software_feature",
                "fields": [
                    {
                        "type": "Date",
                        "enums": null,
                        "field": "createdAt",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    },
                    {
                        "type": "Number",
                        "enums": null,
                        "field": "feature_id",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    },
                    {
                        "type": "Number",
                        "enums": null,
                        "field": "software_id",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    },
                    {
                        "type": "Date",
                        "enums": null,
                        "field": "updatedAt",
                        "inverseOf": null,
                        "isVirtual": false,
                        "reference": null,
                        "isReadOnly": false,
                        "isRequired": false,
                        "isSortable": true,
                        "integration": null,
                        "validations": [],
                        "defaultValue": null,
                        "isFilterable": true
                    }
                ],
                "nameOld": "software_feature",
                "isVirtual": false,
                "isReadOnly": false,
                "integration": null,
                "isSearchable": true,
                "paginationType": "page",
                "onlyForRelationships": false
            },

My feeling is that this second collection is the origin of the issue.
I don’t know why Lumber generates it, but we should find a way to get rid of it for debug purpose.

.forestadmin-schema.json manual edit is clearly an operation that should not be done, because this file is generated on server start in development environments.
But, in order to debug this situation, could you try to manually remove the software_feature of the JSON, commit this change and deploy it in a remote environment where you can test it (beta?).
There is something wrong in the current setup so, as it could clean the setup, I hope it could also fix your issue.

Let us know.