Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide metadata version '3' #15

Open
vahidtakro opened this issue Sep 10, 2021 · 8 comments
Open

Provide metadata version '3' #15

vahidtakro opened this issue Sep 10, 2021 · 8 comments

Comments

@vahidtakro
Copy link

Hello,
I want to test and use use-comments on heroku, but I am not able to import metadata, I get the following error:
key "args" not found

Captkjure

@vahidtakro
Copy link
Author

Okay I fixed this by exporting the provided metadata first, and integrated with the metadata provided in this package.

@beerose
Copy link
Owner

beerose commented Sep 13, 2021

Ah yes, the metadata in this package (version 2) only works with Hasura's versions <= 1.3.x. I'll fix it and provide Hasura's metadata in version 3. Thanks for reporting! I'll reopen this issue to track this.

@beerose beerose reopened this Sep 13, 2021
@beerose beerose changed the title Failed importing metadata Provide metadata version '3' Sep 13, 2021
@SaadBazaz
Copy link

SaadBazaz commented Dec 10, 2021

Facing the same issue. Would be great if this can be mentioned in the docs or the JSON can be uploaded.

note: Got it working using @vahidtakro 's suggestion.

@SaadBazaz
Copy link

SaadBazaz commented Dec 10, 2021

My metadata.json file for Version 3:

{
   "resource_version":3,
   "metadata":{
      "version":3,
      "sources":[
         {
            "name":"default",
            "kind":"postgres",
            "tables":[
               {
                  "table":{
                     "schema":"public",
                     "name":"comments"
                  },
                  "insert_permissions":[
                     {
                        "role":"anonymous",
                        "permission":{
                           "check":{
                              
                           },
                           "columns":[
                              "author",
                              "content",
                              "post_id"
                           ],
                           "backend_only":false
                        }
                     }
                  ],
                  "select_permissions":[
                     {
                        "role":"anonymous",
                        "permission":{
                           "columns":[
                              "author",
                              "content",
                              "created_at",
                              "hidden",
                              "id",
                              "post_id"
                           ],
                           "filter":{
                              "hidden":{
                                 "_ne":true
                              }
                           },
                           "allow_aggregations":true
                        }
                     }
                  ]
               }
            ],
            "configuration":{
               "connection_info":{
                  "use_prepared_statements":true,
                  "database_url":{
                     "from_env":"HASURA_GRAPHQL_DATABASE_URL"
                  },
                  "isolation_level":"read-committed",
                  "pool_settings":{
                     "connection_lifetime":600,
                     "retries":1,
                     "idle_timeout":180,
                     "max_connections":50
                  }
               }
            }
         }
      ]
   }
}

@beerose
Copy link
Owner

beerose commented Dec 10, 2021

There were many significant changes to Hasura since I created this project. I think this is what we should cover in the docs:

  1. Suggest to use Hasura Cloud (there is a free tier and it's the easiest way to set up Hasura).
  2. Create a database via Hasura Console:

Screenshot 2021-12-10 at 12 08 17

Back when this issue was created, the new database URL was stored as a connection string in the metadata, which wasn't great for this project (we would need to tell user to additionally change the URL in the metadata). However, if you use Cloud and create a DB via Heroku, it's stored as `PG_DATABASE_URL`, which makes it simpler.
  1. Change the metadata content and include:
"sources": [
      {
        "name": "default",
        "kind": "postgres",
        "tables": [],
        "configuration": {
          "connection_info": {
            "use_prepared_statements": false,
            "database_url": {
              "from_env": "PG_DATABASE_URL"
            },
            "isolation_level": "read-committed"
          }
        }
      }
    ]

What do you think?

@SaadBazaz
Copy link

SaadBazaz commented Dec 10, 2021

I used Hasura as a Docker container and it set up perfectly. Found it faster than setting up an account, even. 😅

I then followed the steps on your website to get it working.

I think it's best to leave the installation method of choice to the Dev (more flexibility). Or mention that there are more options like local installation.

What if there was a list of metadata.json files for each version?

@beerose
Copy link
Owner

beerose commented Dec 10, 2021

What if there was a list of metadata.json files for each version?

Yeah, that would be cool too.

I think it's best to leave the installation method of choice to the Dev (more flexibility

So maybe let's mention that on the cloud you have to create a DB on your own but then you can use ready metadata, and via Heroku, you'll have a DB but you'd need to set the database connection string.

@SaadBazaz
Copy link

That sounds great. Multiple options with their explained pros/cons is good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants