hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.17k stars 2.77k forks source link

REST Endpoints don't get applied with other metadata #7898

Open asmisha opened 2 years ago

asmisha commented 2 years ago

Version Information

INFO hasura cli version=v2.0.9 INFO hasura graphql engine endpoint="http://localhost:8080/" version=v2.0.10

Environment

Self-hosted

What is the expected behaviour?

Rest endpoints are loaded from config files

Keywords

rest endpoint, metadata, migrations

What is the current behaviour?

Rest endpoints are not loaded from config files

How to reproduce the issue?

  1. Add rest endpoint
  2. Recreate database
  3. Start server with empty database (let it load metadata from files)

Any possible solutions?

rest_endpoints is not saved to config files as far as I see - need to save it along with other pieces of metadata.

poul-kg commented 2 years ago

Same issue with

INFO hasura cli version=v2.3.0-beta.1
INFO hasura graphql engine endpoint="http://localhost:8087/" version=v2.1.1

and with:

INFO hasura cli version=v2.3.0-beta.1
INFO hasura graphql engine endpoint="http://localhost:8087/" version=v2.2.0

rest_endpoints.yaml file is not even created in metadata directory.

even if I create this file manually, and enter correct YAML data there, metadata apply has no effect, REST endpoint is not re-created.

However if you create REST endpoint, export metadata. Destroy hasrua, start up anew and import metadata, then REST endpoints appear again. But this is not a good solution.

epegzz commented 2 years ago

You can hack your way around the issue by creating a script that writes the rest_endpoints.yml file by using the metadata from the database. And another script that 'applies' it by reading from the rest_endpoints.yml file that we generated ourselves and updates the metadata in the database again.

When using Postgres the metadata are stored in hdb_catalog.hdb_metadata.

Buuuut of course, this is far from ideal and I really hope this is gonna be fixed. But since it's not relevant for the paid cloud version, priority might not be too high on that one 😅

kkaarel commented 2 years ago

Is there any update on this issue ?

asmisha commented 2 years ago

Workaround:

REST_ENDPOINTS_METADATA="$(python3 -c 'import sys, yaml, json; y=yaml.safe_load(sys.stdin.read()); print(json.dumps(y))' < "$REST_ENDPOINTS_METADATA_FILE")"
psql -d $HASURA_GRAPHQL_DATABASE_URL -P pager -c "UPDATE hdb_catalog.hdb_metadata SET metadata = jsonb_insert(metadata::jsonb, '{rest_endpoints}', '$REST_ENDPOINTS_METADATA'::jsonb, false)"
thinknirmal commented 2 years ago

Is there an update to this? The issue still exists in v2.8.3

raphaeltm commented 2 years ago

I'm running into the same issue. REST endpoints aren't being exported or imported properly.

Hasura version: v2.8.3 Hasura CLI: v2.8.3

Update: I upgraded to Hasura v2.10.0 and Hasura CLI v2.9.0 (seemingly latest stable version of both) and it still doesn't work.

OliverSo commented 1 month ago

It seems like this is still not fixed (v2.34). Are there any plans to address this?