question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing working subscription operations for read-only models

See original GitHub issue

Describe the bug Related to https://github.com/aws-amplify/amplify-cli/issues/2715 Opening this issue to provide a simple example of when I provide read permissions to all users, I do not have a way to subscribe to the data to get updates.

Amplify CLI Version 4.18.0

To Reproduce

  1. Allow all users to be able to read the model
type ModelReadOnly
  @model
  @auth(rules: [ { allow: owner, operations: [create, update, delete] } ])
{
  id: ID!
  description: String!
}
  1. CreateMutation with owner=111

  2. Query from owner=222, get back model instance with owner 111

  3. There is no subscription operation which does not take in owner field to allow subscribing to onCreate, onUpdate, onDelete of this model instance containing owner 111 from owner 222’s perspective

  4. Allow all users to be able to read/update the model

type ModelReadUpdate
  @model
  @auth(rules: [ { allow: owner, operations: [create, delete] } ])
{
  id: ID!
  description: String!
}
  1. CreateMutation with owner=111
  2. Query from owner=222, get back model instance with owner 111
  3. onUpdate subscriptiono is now public (does not require owner field), owner 222 subscribes to onUpdate
  4. owner=111 does update mutation on previously created model from step 6. owner 222 gets the mutation response.
  5. onCreate and onDelete requires owner to be passed in, there is no way for owner 222 to get the models created and deleted by owner 111, but only updates.

Expected behavior in the first model schema, when owner 222 can read the other owners model instance, there should be a subscription that allows to get mutation events for created/updated/deleted. in the second model schema, when owner 222 can read and update the other owners model instance, there should be a way to get mutation events for created/deleted.

So there should be subscriptions which do not take in the owner field and return data for all model creations/updates/deletes

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
renebrandelcommented, Jun 1, 2020

@SwaySway - can you provide details if your PR is addressing this issue?

0reactions
github-actions[bot]commented, May 26, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grant permission to applications to access an Azure key vault ...
The Azure RBAC model allows uses to set permissions on different scope levels: management group, subscription, resource group, or individual ...
Read more >
Typescript: Type X is missing the following properties from ...
You are returning Observable<Product> and expecting it to be Product[] inside subscribe callback. The Type returned from http.get() and ...
Read more >
GitLab Maintenance Mode
All read-only Git operations continue to work, for example git clone and git pull . All write operations fail, both through the CLI...
Read more >
Overview | Read-Only Raspberry Pi | Adafruit Learning System
Linux—or any substantial computer operating system, Windows and Mac are the ... falling out and getting lost…this read-only setup won't always save you....
Read more >
Troubleshooting migration tasks in AWS Database Migration ...
"Bad event" entries in the migration logs usually indicate that an unsupported data definition language (DDL) operation was attempted on the source database ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found