You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When filtering on a dynamic-set-authorization field it results in an error.
Connection failed: {"errors":[{"message":"The variables input contains a field that is not defined for input object type 'ModelSubscriptionPostFilterInput' "}]}
even though in the debugger i could see, that this error was thrown after i received the expected (filtered) result.
but i was not able to use it and ignore the error. when i had, i received endless errors from the service.
To Reproduce
Model Difinition:
create a model which uses dynamic group based authorization. in this case its authGroup (@see line 08).
01 Post: a02.model({03authGroup: a.string().required(),//to get access to the resource04content: a.string().required(),// that is what the user said05author: a.string().required(),// in a multi-user chat, the AI should track, who says what06playRole: a.string(),// the user can take over different roles too07aiRole: a.string(),//system or user08}).authorization((allow)=>[allow.groupDefinedIn('authGroup')]),
run observeQuery on a model fetching with filter on an authGroup:
in this example i use the a serverside filter (line 04 -06) on the query.
I would expect that i get the query result filtered on a dynamic-set-authorization field without any error
OR to have this noted in the documentation if it is not recommended or bad-practice to do this.
Workaround
I found a workaround:
Introduce a second field (i use the field room) wich contains the exact same content like authGroup.
I use room for serverside filtereing and authGroup for the authorization (the user has to be in this group to get even a chance of seeing this message).
Desktop (please complete the following information):
OS: Win 11
Browser chrome
Version 129.0.6668.101
Additional context
Use case is, that i am going to write some kind of chat program, where you can manage and share my rooms based on Cognito User Pools and store the chat history in the Post-model.
The text was updated successfully, but these errors were encountered:
When filtering on a dynamic-set-authorization field it results in an error.
Connection failed: {"errors":[{"message":"The variables input contains a field that is not defined for input object type 'ModelSubscriptionPostFilterInput' "}]}
even though in the debugger i could see, that this error was thrown after i received the expected (filtered) result.
but i was not able to use it and ignore the error. when i had, i received endless errors from the service.
To Reproduce
Model Difinition:
create a model which uses dynamic group based authorization. in this case its
authGroup
(@see line 08).(there is documented how to use
authorization-rules-for-dynamically-set-user-groups )
run observeQuery on a model fetching with filter on an authGroup:
in this example i use the a serverside filter (line 04 -06) on the query.
(there is documentation for using server-side-subscription-filters )
Expected behavior
I would expect that i get the query result filtered on a dynamic-set-authorization field without any error
OR to have this noted in the documentation if it is not recommended or bad-practice to do this.
Workaround
I found a workaround:
Introduce a second field (i use the field
room
) wich contains the exact same content like authGroup.I use
room
for serverside filtereing andauthGroup
for the authorization (the user has to be in this group to get even a chance of seeing this message).Desktop (please complete the following information):
Additional context
Use case is, that i am going to write some kind of chat program, where you can manage and share my rooms based on Cognito User Pools and store the chat history in the Post-model.
The text was updated successfully, but these errors were encountered: