Closed jcmoore0 closed 3 years ago
Thanks for the report! I think I know what’s causing this—we added some additional caching to the metadata reloading process, and it’s being a little too aggressive for enum tables (the enum values aren’t technically part of the metadata, so it thinks the table “didn’t change” and skips reprocessing it). The fix should be easy.
Hi @lexi-lambda - I am still having issues with the new v1.1.0-beta.3 release.
'reload enum values' - intermittently works ~20% time 'make table an enum' - doesn't work after many tries
Thanks for the help. Best regards,
@jcmoore0 Could you say more about what you’re seeing? Are you getting any errors, or is there just no effect whatsoever?
@lexi-lambda - I don't get any errors. It's just not changing the schema. Thanks, John
Hi @lexi-lambda - I just realized the schema will not include enum until a relationship is created to an enum table.
Update: 'reload enum values' - intermittently works ~20% time -> restart server as a work around 'make table an enum' - works -> need to create a relationship to the enum table first
Thanks for the help. Best regards,
Still a problem in v1.2.0-beta.2
After adding a new value to the enum table, I reloaded enum values multiple times but still metadata wasn't updated. I get following err:
graphql-engine_1 | Spock Error while handling ["v1","query"]: expected one of the values "en", "de" for type "settings_locales", given "fr"
fr
is a new value in enum table.
Restarting hasura server helped.
I am experiencing the same problem, no matter how many times I reload it, new values don't show up. Will try restarting the server.
It would be very helpful if you should share a schema that reproduces the issue! Otherwise it’s hard to know what’s going on.
Hi @lexi-lambda - 'Reload enum values' doesn't update schema. It's not super urgent since there is a workaround by restarting the server.
I just ran a simple test and included migrations here: https://github.com/jcmoore0/hasura_enum
Let me know if you need something else.
Best regards,
Thanks, that’s extremely helpful! I can’t promise that we’ll look into it immediately, but I’ll definitely make sure it gets looked at in the near future.
This seems to be fixed with latest release (v1.2.0-beta.3) After clicking "reload enum values" metadata is updated correctly and there's no need to restart hasura server anymore.
Thanks! 🙏
Confirmed fix. Thanks, great job.
It's still not updated here, I'm running hasura 1.2.1. After adding new values, I can't use the new values in insert operations. If I query the enum field using the graphiql/api-explorer, the new values are there.
Switching off and 'Set table as enum' does reload the values.
In any case, if there's a button 'reload values, it should work :).
The same happens here! Hasura 1.1.1, I insert some values, click to "reload values" and doens't work
I do the "switching off and 'Set table as enum'" workaround and it works!
v1.2.2 the same issue. @marionschleifer it's more than half year for pretty serious bug )
Hi All, Same issue on Hasura 1.3.
i believe that might be what's causing this as well:
running same query multiple times (with an enum_userOnboardingStatus_enum_comparison_exp
) returns failure about 50% of the time.
this was after a migration that added a new enum value.
i force-restarted all of my hasura instances, and this problem went away completely. so yes. seems like caching is the issue.
this is on 1.3.0 running 2 dynos on heroku.
Still having this problem on version 1.3.2 had to "force new deployment" on my AWS ECS Service. I tried both reloading the enum table and reloading all metadata.
Having issue on Hasura 1.3.2. Brand new docker container & database, schema not updating when new enums are added to database table.
This is happening to me on Hasura Cloud. I literally can't update my application because of this bug.
I finally got to looking into this, and I’m afraid to say I still cannot reproduce this on my machine. :slightly_frowning_face: I tried following the steps in https://github.com/hasura/graphql-engine/issues/3759#issuecomment-603013180 a few times against graphql-engine v1.3.2, but every time I pressed “Reload Enum Values,” I saw the schema immediately update.
This is frustrating, because obviously the issue is happening for several people. I am definitely not denying that! But I have no idea what could possibly be going wrong, and without being able to reproduce the problem, I am not sure how to proceed.
Here are the full details of my environment:
hasura/graphql-engine:v1.3.2
If anyone can provide an environment that consistently reproduces this issue, I’d be much obliged. In the meantime, I’m afraid I’m at something of a loss.
Hi, @lexi-lambda here is the reproduction:
CREATE TABLE test_enum (
val text PRIMARY KEY,
description text
);
INSERT INTO test_enum (val, description) VALUES ('FIRST', 'First test enum val'), ('SECOND', 'Second test enum val');
3. Created in console SQL. type - ref to test_enum
```sql
CREATE TABLE use_enum (
id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
type text NOT NULL REFERENCES test_enum
);
INSERT INTO use_enum (type) VALUES
('FIRST'),
('SECOND');
Good news: with the help of both the comments on this issue and some investigation by a couple other folks on the team, I finally managed to consistently reproduce the issue on my machine. PR #6027 has the fix, which should hopefully finally resolve this problem for good once merged. Thank you all for your patience!
For hasura newbies like me: add Foreign key below columns, not Relation.
Hi @lexi-lambda is there a workaround for this for hasura v1.3.2?
Just registering that this is still happening to my project on version 2.1.0-beta.3
CLI / v2.1.0
gql engine. If there doesn't exist a foreign key to an enum table, then the enum won't be generated in GQL (and therefore graphql-codegen
also won't create the enum in my TypeScript project). This is easily worked around by just making a dummy table that just contains a foreign key to the enum table, then immediately removing that table (by running the down migration for instance) to de-clutter the database; but that's ugly and counterintuitive, so would prefer if the enum just got created reliably!
Also tried editing the enum variables after doing the above workaround - it does update without needing to re-introduce the foreign key. So only seems to be an issue when creating the enum table for the first time. nevermind seems to have disappeared when i removed that table :( kinda sucks but i'll just be keeping a dummy table.
Hey @lexi-lambda, it's not working on v2.2.1
. I tried reloading enums, disabling and enabling enum on a table. Whatever I do, it just isn't added as enum to scheme.
It only works if there is a FK on other table used as @osdiab mentioned.
This is still an issue in v2.16.1, the only fix seems to be to create a seperate dummy table with a foreign key to trick hasura into generating the enum type.
Tried reloading metadata, but just got errors. Restarting the server did the trick for me
Still getting this error on v2.25.1 @lexi-lambda
Hi there,
I'm experiencing the same issue in version 2.42.0. It was working with the previous added enum, but when we added a new enum in a different schema, it's not being picked up and is causing an error in the fetch query.
Is there any solution? @hpsmatheus, has this been resolved yet?
Thank you Hems Patel Tracksuit
Problem: Enums are not updating v1.1.0-beta.2
Details/ Steps to Reproduce:
New Enum
Change Enum