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

Detected multiple owner type auth rules with a READ operation. #1590

Closed
TimmBaier opened this issue Jan 12, 2022 · 19 comments
Closed

Detected multiple owner type auth rules with a READ operation. #1590

TimmBaier opened this issue Jan 12, 2022 · 19 comments
Labels
datastore Issues related to the DataStore category feature-request Request a new feature follow up Requires follow up from maintainers

Comments

@TimmBaier
Copy link

Describe the bug

I have this schema:

type Profile @model 
@auth(rules: [
  {allow: owner}, 
  {allow: owner, ownerField: "followerIDs", operations: [read]},
  {allow: public, provider: apiKey}
  ]) {
  id: ID!
  name: String
  ...
  followerIDs: [String]
}

When I use DataStore I can query and create Profiles, but I can't update Profiles and get following warning:

Detected multiple owner type auth rules with a READ operation. We currently do not support this use case. Please limit your type to just one owner auth rule with a READ operation restriction.

Is it correct, that the use case above is not possible with amplify (DataStore) on iOS, or do anyone have an idea what I'm doing wrong?

Steps To Reproduce

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Expected behavior

I should be able to update models that have two owner types defined.

Amplify Framework Version

1.18.1 (2021-12-15)

Amplify Categories

DataStore

Dependency manager

Swift PM

Swift version

5.0

CLI version

7.6.5

Xcode version

13.2.1

Relevant log output

No response

Is this a regression?

No

Regression additional context

No response

Device

iPhone 12 simulator

iOS Version

iOS 15.2

Specific to simulators

No response

Additional context

No response

@ameter ameter added datastore Issues related to the DataStore category pending-triage Issue is pending triage labels Jan 13, 2022
@diegocstn
Copy link
Contributor

Hi @TimmBaier,
thanks for reporting this us.
Your schema is valid and I believe the error message you're seeing is an old check we put in place before implementing multiple authorization rules.
We are currently looking into and we'll update this issue with our findings.

@diegocstn diegocstn added bug Something isn't working and removed pending-triage Issue is pending triage labels Jan 15, 2022
@TimmBaier
Copy link
Author

If I have the env deployed with the schema above, just comment out the second owner locally and generate the swift code with amplify codegen models I can update and sync without problems.

@maziarzamani
Copy link

If I have the env deployed with the schema above, just comment out the second owner locally and generate the swift code with amplify codegen models I can update and sync without problems.

What if I need the second owner?

@royjit royjit added the work in progress Issues was triaged and investigation done label Jan 28, 2022
@diegocstn
Copy link
Contributor

Unfortunately dynamic auth rules like array of owners aren’t fully compatible with DataStore at the moment as subscriptions with multiple owner rules require extra support from the service, therefore we'll need to hold off a bit on the PR.
@maziarzamani @TimmBaier we'll update this thread and the PR.

@maziarzamani
Copy link

Unfortunately dynamic auth rules like array of owners aren’t fully compatible with DataStore at the moment as subscriptions with multiple owner rules require extra support from the service, therefore we'll need to hold off a bit on the PR.
@maziarzamani @TimmBaier we'll update this thread and the PR.

Hi @diegocstn. Thanks for the reply. Is there a workaround? Our product relies on multiple owners, without this we cannot launch, ever.

@lawmicha lawmicha removed the bug Something isn't working label Feb 18, 2022
@atierian atierian added feature-request Request a new feature follow up Requires follow up from maintainers labels Mar 28, 2022
@maziarzamani
Copy link

Any update on this one? Our project is still stuck.

@Etep15
Copy link

Etep15 commented Apr 1, 2022

I too am looking for this feature. After finally figuring out the right way to handle this I got hit by this error with subscriptions. I filed an issue #10110 that talks about what use case I'm seeking BUT the relevant info related to this issue is in my first comment which speaks to exactly this.

@maziarzamani
Copy link

Unfortunately dynamic auth rules like array of owners aren’t fully compatible with DataStore at the moment as subscriptions with multiple owner rules require extra support from the service, therefore we'll need to hold off a bit on the PR.
@maziarzamani @TimmBaier we'll update this thread and the PR.

You mentioned "subscriptions", what if we do not use subscriptions? As far as I can see the iOS SDK fails with the presence of arrays without initiating any subscriptions.

@djorgji
Copy link

djorgji commented May 9, 2022

Unfortunately dynamic auth rules like array of owners aren’t fully compatible with DataStore at the moment as subscriptions with multiple owner rules require extra support from the service, therefore we'll need to hold off a bit on the PR. @maziarzamani @TimmBaier we'll update this thread and the PR.

With this finally released for AppSync, https://aws.amazon.com/blogs/mobile/appsync-enhanced-filtering/
and with the CLI adding support soon: aws-amplify/amplify-category-api#389 what is the timeline for dynamic group support for subscriptions for iOS? Would making SyncExpressions server sided also make sense?

@maziarzamani
Copy link

Any update?

@bflatone
Copy link

We do also require the feature to have multiple owner type auth rules to share data from the "creator" of the record to many different read-users. The auth rules look like this:

      { allow: owner, ownerField: "owner" operations: [create, read, delete, update] }
      { allow: owner, ownerField: "readers", operations: [read, update] }

Is there any update by when this will be available?

@bzark
Copy link

bzark commented Nov 18, 2022

We do also require the feature to have multiple owner type auth rules to share data from the "creator" of the record to many different read-users. The auth rules look like this:

      { allow: owner, ownerField: "owner" operations: [create, read, delete, update] }
      { allow: owner, ownerField: "readers", operations: [read, update] }

Is there any update by when this will be available?

@dnys1 this is the same issue I reported to you way back in November of 2021, correct? I know there are a few issues open on this, do any of them have additional information that may be useful to @bflatone and myself? I'm still looking to implement multiple owner records with subscriptions using DataStore. Please advise and thanks for your continued help.

@maziarzamani
Copy link

Any progress?

@bzark
Copy link

bzark commented Dec 12, 2022

Any progress?

I'm looking at this stuff as we speak. I uncovered this re:Invent video last night and this looks promising. The video link below is at the current time of the auth rules that coincide to the ones I need for my project. They talk about real-time sync between customer order and the driver flutter app so this all seems very promising. FYI, they are using BETA flutter plugins.

AWS re:Invent 2022

@maziarzamani
Copy link

Bumping for an update

@ErlendHer
Copy link

Any progress?

@uzaymacar
Copy link

Any update on this, we have a similar use case?

@lawmicha
Copy link
Member

lawmicha commented Jan 8, 2024

I believe the changes to enable this use case was merged in from #3223

Please try with the latest Amplify version and let us know in a new issue with your schema use case if something isn't working.

@lawmicha lawmicha closed this as completed Jan 8, 2024
Copy link
Contributor

github-actions bot commented Jan 8, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore category feature-request Request a new feature follow up Requires follow up from maintainers
Projects
None yet
Development

No branches or pull requests