#Schema Not Found Error

1 messages ยท Page 1 of 1 (latest)

warm blade
#

Hello @hard crescent , can you send which API this response belongs to and the request metadata?

hard crescent
#

For example, {{permifyUrl}}/v1/tenants/:tenantId/permissions/check

{
  "metadata": {
    "snap_token": "",
    "schema_version": "",
    "depth": 30
  },
  "entity": {
    "type": "section",
    "id": "9"
  },
  "permission": "editor",
  "subject": {
    "type": "user",
    "id": "142",
    "relation": ""
  }
}

But it happens to all apis

warm blade
#

Could you send me the schema you wrote last?

hard crescent
#

hmm i just noticed that one of the developers in my team updated the schema

#

maybe that's why

#

i'll update my db

warm blade
#

the reason I'm asking is that this error will be returned if there is no 'section' entity or if the 'section' entity does not have a relation called 'editor'

hard crescent
#
entity section {
    relation administrator @user @predefined_role#member
    relation editor @user @predefined_role#member
    relation viewer @user @predefined_role#member
    relation no_access @user @predefined_role#member
#

i've deleted my local database... i'll start from scratch

warm blade
#

If this entity exists in the database in the latest schema version, it should work

hard crescent
#

haaaaa im stuck, how do i create the tables again...

warm blade
#

which version of Permify are you using?

hard crescent
#

I deleted my db and now I'm having troubles setting it up again

#

5.0

#

database:
  engine: 'postgres'
  uri: 'postgres://postgres:secret@host.docker.internal:5433/permify'
  auto_migrate: false
  max_open_connections: 20
  max_idle_connections: 1
  max_connection_lifetime: 300s
  max_connection_idle_time: 60s
  garbage_collection:
    enable: true
    interval: 3m
    timeout: 3m
    window: 720h
    number_of_threads: 1
warm blade
#

Can you upgrade to permify version v0.5.4 and set auto migrate to true in this config?

hard crescent
#

ok

#

seems to do the trick... was it the automigrate?

warm blade
#

additionally, if you don't want to run auto migrate, we have commands like migrate up, migrate reset.

hard crescent
#

what does that do?

#

my concern is that, if we change the schema in the future, what do we need to do? surely we can't truncate the db in production...

warm blade
#

our suggestion here is to specify the schema version in the metadata. This will allow you to work with the schema from the older version. If you don't specify it, the latest version will be used

#

do you generally foresee the changes you'll make to the schema to be major changes?

#

are we talking about the authorization schema here, or the Postgres schema? I might have misunderstood

hard crescent
#

i don't think we are planning to do new major changes for the moment but since we're still in the migration process, it can be

#

the authorization schema

#

the reaosn for my first message was that I suddenly got these error 13 SCHEMA_NOT_FOUND even though there was a schema in the database

#

I think now that I've deleted everything, that it was due that someone in my team deleted the config.yaml

#

So probably permify was running in memory writeDB, am i right ?

warm blade
#

yes, if the config has changed, it will work in memory by default

#

would it be a better approach for you if, for such situations, it returns 'DENIED' instead of an error message?

hard crescent
#

no, i don't think it would help that much

#

it's just that i forgot that in order to run on pgsql, you needed a config.yaml file. I thought it was by default

#

so I couldn't understand why it said "no schema" while in my database there were actually schema defined. It just didn't know to run on pgsql if there was no config.yaml

#

on another note, were there breaking changes from v4 to v5? I get these errors in my setup now (grpc)

mifyModule","payload":{"error":{"path":"/base.v1.Relationship/Write","code":12,"details":"unknown service base.v1.Relationship"},
#

guess it was, it's called data

warm blade
hard crescent
#

thanks for the support by the way ๐Ÿ™‚

warm blade
#

You're very welcome! I'm glad I could assist you ๐Ÿ™‚

bold veldt
#

Hey @hard crescent ,

In case you want to prevent this kind of problems, and easy rollback; we have a managed service and on-premise plans.