graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Console Errorring Out When Event and Data Exist / Events not being created in Postgres on metadata apply

Open stevenkaspar opened this issue 4 years ago • 8 comments

I keep getting the below error when I try to navigate to this URL in my console

VERSION: Server: 2.1.1 and CLI: 2.5.0-beta.1 (was getting on non beta version too) URL: http://localhost:9695/console/data/postgres/schema/public/tables/thread_messages/browse (I get the same result when going through hasura container image)

Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at oc (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5486981)
    at https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5432151
    at Zo (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5442287)
    at Ql (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5482766)
    at zl (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5473739)
    at jl (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5473664)
    at kl (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5470514)
    at https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5421486
    at t.unstable_runWithPriority (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5497297)
    at oa (https://graphql-engine-cdn.hasura.io/console/assets/channel/stable/v2.1/vendor.js.gz:1:5421195)

Screen Shot 2022-04-02 at 7 45 16 AM

TABLE METADATA:

table:
  name: thread_messages
  schema: public
object_relationships:
- name: thread
  using:
    foreign_key_constraint_on: thread_id
- name: user
  using:
    foreign_key_constraint_on: user_id
event_triggers:
- definition:
    enable_manual: true
    insert:
      columns: "*"
    update:
      columns: "*"
  name: thread_message_insert_update
  retry_conf:
    interval_sec: 10
    num_retries: 5
    timeout_sec: 60
  webhook_from_env: HASURA_HANDLER_EVENTS_URL

It only show error after inserting value into table (from Hasura console)

Screen Shot 2022-04-02 at 7 47 29 AM

Screen Shot 2022-04-02 at 7 49 01 AM

It does have the event and this is the first time I've used those so I'm going to try removing the event and then removing date fields and see what causes the issue


UPDATE

Removing the event causes it to work and adding the event back immediately returns the error

Heading to the event docs to see if I'm missing something

stevenkaspar avatar Apr 02 '22 12:04 stevenkaspar

So I figured out what was going on. I have the event defined in the table metadata, but it doesn't get created in postgres when I restart from a clean instance - so the event shows in metadata but not in postgres and I think that's why it's erroring out

Do I need to create a migration for the event's trigger to get created in hdb_catalog?

stevenkaspar avatar Apr 02 '22 16:04 stevenkaspar

@stevenkaspar Which version of CLI are you using? Did you delete the Postgres triggers manually by any chance?

I think the console issue and the server issue could be unrelated.

tirumaraiselvan avatar Apr 05 '22 12:04 tirumaraiselvan

@tirumaraiselvan version=2.5.0-beta.1. No I didn't delete them manually

Should the hasura metadata apply command create those Postgres views?

stevenkaspar avatar Apr 05 '22 12:04 stevenkaspar

@stevenkaspar

Should the hasura metadata apply command create those Postgres views?

Yes. But it doesn't recreate them if Hasura expects them to be present previously. Do you mind jumping on a quick call to diagnose this issue? I am available at https://meet.google.com/kjs-mqtw-wkn

tirumaraiselvan avatar Apr 05 '22 12:04 tirumaraiselvan

Turns out the server version was 2.1.1 and CLI version was 2.5.0-beta.1. We couldn't reproduce the console bug.

tirumaraiselvan avatar Apr 05 '22 13:04 tirumaraiselvan

For those curious, we got on a call and the UI console bug isn't showing, but the triggers still aren't getting created as views in my Postgres instance

Steps

  • Delete cluster and database
  • Run hasura metadata apply && hasura migrate apply && hasura metadata apply

Expect to see trigger's views in Postgres, but there are none

Tried running with these versions

  • hasura CLI v2.5.0-beta.1, graphql-engine:v2.1.1

@tirumaraiselvan I did the steps above with matching versions for the CLI and engine (v2.5.0-beta.1) and the triggers were created - so it must be an issue with the mismatching versions. my bad on that

stevenkaspar avatar Apr 05 '22 13:04 stevenkaspar

@stevenkaspar Thanks for your collaboration. I am going to close this issue now. We have a different (but related) issue to tackle an edge case with Postgres trigger creation tracked here: https://github.com/hasura/graphql-engine/issues/8376

I will close this issue now. Please feel free to reopen if you encounter the issue again.

tirumaraiselvan avatar Apr 05 '22 15:04 tirumaraiselvan

Hi @stevenkaspar my name is Harsha and I work on the community team at Hasura. I wanted to get in touch with you regarding this issue. Could you mail me at [email protected]?

Thanks.

a-chocolate-bear avatar Apr 15 '22 10:04 a-chocolate-bear