Issue with relationships not showing in a database and cannot be configured (web interface)

Feature(s) impacted

I can’t use / display the relationship inside a database.
Here is an example (the companyPlanId should be a relation field) :

Observed behavior

We have the same database in a staging environment and the relationships are displayed correctly:

I’ve tried to refresh the schema and to unlink / link again the main database with no success. I can’t see any relationships in the whole database

Expected behavior

We expect to have our field relationship in our production database on Forest Admin, since they have the same schemas.

Context

  • Project name: 34 Trucs - Production (+ see 34 Trucs - Staging for reference)
  • Team name: 33 Trucs
  • Environment name: Production
  • Agent technology: web version used
  • Agent (forest package) name & version: no agent, only the cloud version is used
  • Database type: PostgreSQL
  • Recent changes made on your end if any: none since the account creation
  • ORM : Prisma

Hello @mathieu_33trucs and welcome to our community.

I have looked into the schema that the Forest Admin cloud agent has analyzed from your databases, and I could see a lot of differences between staging and production projects, which explain what you are seeing above.

In particular, the field CompanyPlan of the table Company is seen as a plain field, not part of a relationship, but also many other differences (fields missing on one schema or the other, or different validation rules, like a field being required in one of the schemas but not the other).

You might want to check again the schemas of your datasources. Alternatively there might have been a mistake when entering your database credentials, which means that one or the other of your projects is not targeting the database that you mean.
Unfortunately if this is the latter, there is no way to check the credentials from your Forest Admin panel since those are “write only” for security purposes. The only way is to make sure is to re-enter them by going in your project settings / environment → select Production environment → then select your datasource in the list at the end and lastly Update datasource to re-enter your credentials.

I hope this helps :pray:

Hi @Nicolas.M,

Thanks for your reply.

So, I’ve clicked on “Update credentials”.
Next, I’ve updated all the credentials + clicked on “Sync database schema”

It takes a few seconds to apply changes:

After that, I’ve refreshed my browser but nothing change:

No error encountered during the process.

I did it a few minutes ago.

This is strange.

Could you please share the postgre schema of the tables with the missing relationship, as well as the schema of the relationship itself ? In private message if you prefer :pray:
Thanks

I have received your message, thanks :pray:

Thanks for all the details provided in private.

I’m following up with a public resolution.

It appears that the issue was caused by insufficient rights given to the database user accessing your data on behalf of the Forest Admin cloud agent.
Althought it dit have CRUD permission on all tables of the given schema it was lacking a specific permissions to list records in the information_schema.constraint_column_usage, which prevented the agent for properly detecting relationships.

The way postgre handles this is to only return records for which the user has rights, and unfortunately it does not throw any errors that we could catch and return, which means that the introspection failure was silent.
This may even be specific to the google cloud postgre implementation:

I’m currently looking for a way to catch and handle this error correctly so that it may be correctly returned by the Forest Admin agent and shown to the user.

I will follow up on this post if and when a fix is applied.

In the meantime, I would advise you to ensure that the user created to accessing the database has the rights to view all records in information_schema

:pray:

@Nicolas.M thanks a lot for the following! :pray:

I’ll check the grant permission on my side and post here any technical solution.

Best,

1 Like